Skip to content

Instantly share code, notes, and snippets.

@c99koder
Last active August 29, 2015 14:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c99koder/201d7aad10352208a813 to your computer and use it in GitHub Desktop.
Save c99koder/201d7aad10352208a813 to your computer and use it in GitHub Desktop.
from ws4py.client.threadedclient import WebSocketClient
class DummyClient(WebSocketClient):
def opened(self):
print "Opened websocket"
def closed(self, code, reason=None):
print "Closed down", code, reason
def received_message(self, m):
print m
if __name__ == '__main__':
try:
ws = DummyClient('wss://www.irccloud.com')
ws.url = "https://www.irccloud.com" #send the correct Origin header
ws.extra_headers = [('Cookie','session=XXX’)]
ws.connect()
ws.run_forever()
except KeyboardInterrupt:
ws.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment