Last change
on this file since 31 was 31, checked in by bart, 3 years ago |
Geniusweb 2.0.3. MOPAC protocol translated to Python. Small fixes.
|
File size:
643 bytes
|
Rev | Line | |
---|
[31] | 1 | import time
|
---|
| 2 |
|
---|
| 3 | import com.neovisionaries.ws.client.WebSocketAdapter as WebSocketAdapter
|
---|
| 4 | import com.neovisionaries.ws.client.WebSocketFactory as WebSocketFactory
|
---|
| 5 |
|
---|
| 6 | class PythonDownloadProfile(WebSocketAdapter):
|
---|
| 7 |
|
---|
| 8 | def __init__(self):
|
---|
| 9 |
|
---|
| 10 | factory = WebSocketFactory()
|
---|
| 11 | factory.setConnectionTimeout(5000)
|
---|
| 12 | ws = factory.createSocket("ws://localhost:8080/profilesserver/websocket/get/jobs/jobs1")
|
---|
| 13 | ws.addListener(self)
|
---|
| 14 |
|
---|
| 15 | ws.connect()
|
---|
| 16 | time.sleep(2) # just briefly wait for possible updates
|
---|
| 17 | ws.disconnect()
|
---|
| 18 |
|
---|
| 19 | def onTextMessage(self, websocket, json):
|
---|
| 20 | print "received message: "+json |
---|
Note:
See
TracBrowser
for help on using the repository browser.