Jump to content

Websocket usage workflow


mezz64

Recommended Posts

I'm working on expanding an existing python library that uses the HTTP api to interact with emby to use websockets where possible to allow for faster updates with less polling.

 

Looking through the websockets documentation and in doing some testing I can't seem to find a way to initiate a single websocket connection that would give me events for all devices currently active in emby.  Am I missing something or this the intended usage?

 

Thus far the best workflow I can come up with is query the api for currently active device and then open a websocket connection for each active device.

 

Any insight is appreciated. Thanks.

Link to comment
Share on other sites

Digging into this some more it seems that if I connect to the websocket with a registered DeviceID I receive events from all currently active devices.  So that's a step in the right direction. 

 

Also, is there a way to get emby to push progress updates through the websocket?  I noticed it was asked in an older thread, but I'm not able to decipher the right message packet to send into the websocket from the dashboard/javascript code.

 

Once again any help is much appreciated.

Edited by mezz64
Link to comment
Share on other sites

For the benefit of someone else looking for this information I finally figured out the correct syntax for the websocket message to ask the server to provide session updates on an interval.

 

The 1500 is the interval in milliseconds.

{"MessageType":"SessionsStart", "Data": "0,1500"}

{"MessageType":"SessionsStop", "Data": ""}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...