I\'m trying access some data using websockets, but I cannot really get around the examples given in the websockets documentation.
I have this code (https://pypi.org/proj
You need to add "self" to you class methods:
class MySocket(object):
def __init__(self):
websocket.enableTrace(True)
self.ws = websocket.WebSocketApp("ws://echo.websocket.org:12300/foo",
on_message = self.on_message,
on_error = self.on_error,
on_close = self.on_close)
def on_message(self, ws, message):
print message
def on_error(self, ws, error):
print error
def on_close(self, ws):
print "### closed ###"
def on_open(self, ws):
ws.send("Hello %d" % i)