Add WebSocket connection to StreamService #307
Comments
@AlexArcPy I have not really looked at this, but do you think you could leverage the socket library? |
@achapkowski Andrew, let me check if socket module is capable of establishing web socket connection. Doesn't look as easy to work with as using websocket-client package. |
@achapkowski I have browsed around and it doesn't seem as as builtin module |
@AlexArcPy I am not opposed to using 3rd party modules as long as the license allows for there use in this type of project. |
@AlexArcPy use the 3rd party module. |
@achapkowski , thanks for getting back on this. I just didn't have time to respond to you; so this issue is paused on my site so far... sorry for that! |
ArcRest
3.5.6
Enhancement
Shall we add support for the StreamService that comes with GeoEvent Extension? I've just added support StreamService now in the main repo, so we can get static properties. It would be really cool if one could connect to the service via the WebSocket and listen to events in Python. The REST page of Subscribe.
To connect with web sockets in Python, I used the websocket-client 0.37.0 package. Seems to be easy to use and stable. Below is a simple snippet for reading events from StreamService.
What's the best way to build in the websocket client so users don't need to install it themselves? Another thing is we are going to need to establish connection with
ws://
, so the current code will fail to run at the point of url type verification (it's not http/https).I tested on a local simple StreamService and the code below worked fine.
Repo Steps or Enhancement details
>>> gives the next event in JSON
The text was updated successfully, but these errors were encountered: