Created
May 13, 2014 01:03
-
-
Save CRamsan/a52b30dc14a20881f11f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import websocket | |
import thread | |
import time | |
import json | |
def on_message(ws, message): | |
print message | |
json.loads(request.read().decode('utf8')) | |
def on_error(ws, error): | |
print error | |
def on_close(ws): | |
print "### closed ###" | |
def on_open(ws): | |
def run(*args): | |
ws.send("{\"service\":\"event\",\"action\":\"subscribe\",\"worlds\":[\"1\",\"9\",\"10\",\"11\",\"13\",\"17\",\"18\",\"19\",\"25\"],\"eventNames\":[ \"MetagameEvent\" ]}") | |
thread.start_new_thread(run, ()) | |
if __name__ == "__main__": | |
ws = websocket.WebSocketApp("wss://push.planetside2.com/streaming?service-id=s:PS2Link", | |
on_message = on_message, | |
on_error = on_error, | |
on_close = on_close) | |
ws.on_open = on_open | |
ws.run_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment