import time import com.neovisionaries.ws.client.WebSocketAdapter as WebSocketAdapter import com.neovisionaries.ws.client.WebSocketFactory as WebSocketFactory class PythonDownloadProfile(WebSocketAdapter): def __init__(self): factory = WebSocketFactory() factory.setConnectionTimeout(5000) ws = factory.createSocket("ws://localhost:8080/profilesserver/websocket/get/jobs/jobs1") ws.addListener(self) ws.connect() time.sleep(2) # just briefly wait for possible updates ws.disconnect() def onTextMessage(self, websocket, json): print "received message: "+json