source:
src/test/java/geniusweb/examples/PythonDownloadProfile.py@
28
Last change on this file since 28 was 28, checked in by , 4 years ago | |
---|---|
File size: 643 bytes |
Rev | Line | |
---|---|---|
[28] | 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.