Help connecting to the websocket in python.

Discussion in 'Census: Planetside 2' started by Slidedrum, Dec 22, 2014.

  1. Slidedrum

    Slidedrum Guest

    I am trying to connect to the Planetside 2 api in Python. I can poll ps2/characters_event no problem. But I can't seem to connect to the websocket server, as I am not sure what port to use (I think). So what port does the Planetside 2 API use? currently I have this (the relevant part anyway):
    import socketimport timePS2 = socket.socket()PS2.connect(('wss://',6667))while 1:    time.sleep(1)    print PS2.recv(2048)
    and I get this error:
    Traceback (most recent call last):  File "C:/Users/Slidedrum/Desktop/py/", line 4, in <module>    PS2.connect(('wss://',6667))  File "", line 224, in meth    return getattr(self._sock,name)(*args)gaierror: [Errno 11004] getaddrinfo failed
    Any help would be appreciated, thanks.
    Last edited by a moderator: Dec 14, 2016
  2. kalimag

    kalimag Guest

    Websockets use standard HTTP(S) ports by default, i.e. 443 for WSS.

    "getaddrinfo failed" sounds more like a DNS issue or something along those lines, though. I'm not familiar with Python, but are you sure that socket is actually the right library? There's a difference between ordinary (IP) sockets and websockets, the latter of which are a specialized protocol built on top of HTTP

Share This Page