Hello, everyone I realize this is a rather old entry, but I'd like to share 
my findings. I've had some success on connecting to the realtime API using 
the socketIO-client-nexus library
Apparently it's regarding an issue with the socketio protocol used by the 
AW server, since the original socketio-client only supports the 1.x protocol
I've written a code that manages to connect and subscribe to my WS-2902, 
although it issues a Warning error for some reason, looks like it has 
something to do with it trying to call a polling transport for a 2nd time,  
still it looks like it doesn't affect the program (although it does get me 
a bit nervous)...

I'll attach the test code I used along with some of the results I've been 
getting, I've only been using powershell for tests, so apologies for it 
looking so cluttered...
I hope it's useful for you guys, I know you suffered as much as me trying 
to get this to work.

Cheers.

El lunes, 20 de agosto de 2018, 15:19:05 (UTC-5), Pat escribió:
>
> I have not. I was hoping someone from AW would reply as well. You may be 
> better off with the node developer for the time being. AW is using 
> socket.io which seems very node friendly, and not so much Python. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
from socketIO_client_nexus import SocketIO


def on_connect(*args):
    print("Connected Yes", args)
    print("attempting subscription")
    socketIO.emit("subscribe", {"apiKeys":[apikey]})

def on_message(*args):
    print("Message", args[0].decode("utf-8"))

def on_subscribed(*args):
    print("Subscribed", args)

def on_data(*args):
    print("DATA!", args)


appkey = "YOUR APPKEY HERE"
apikey = "YOUR APIKEY HERE"
socketIO = SocketIO("https://api.ambientweather.net";,
                    443,
                    transports=['websocket'],
                    params={"api":1,
                            "applicationKey":appkey})

socketIO.on("connect", on_connect)
socketIO.on("message", on_message)
socketIO.on("subscribed", on_subscribed)
socketIO.on("data", on_data)
# print("Waiting for data")
socketIO.wait(seconds=300)

Reply via email to