Connecting to a Websocket

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
eirik226
Experienced User
Posts: 142
Joined: Wed Nov 07, 2012 5:22 pm

Connecting to a Websocket

Post by eirik226 » Sun Nov 12, 2017 5:02 pm

Hello,

For the past week i've been trying to connect to the Emby websocket.

Emby is a media server running on my local network --> Link to Emby: https://emby.media/

Here is the wiki for websockets and emby: https://github.com/MediaBrowser/Emby/wiki/Web-Socket

Today I finally manged to connect to it and recieve data when I play a movie etc, but the data displayed is spammed to my log and I am having trouble using it and printing it out in a readable format. I'll upload a picture so you can see.

When I press a movie or go out of that movie the log is spammed with several of the same messages, as you can see in the picture.

How do I make it only display it once and use json to get the data out?

Thanks for any help.
Attachments
to_EG.JPG

eirik226
Experienced User
Posts: 142
Joined: Wed Nov 07, 2012 5:22 pm

Re: Connecting to a Websocket

Post by eirik226 » Sun Nov 12, 2017 5:23 pm

I actually solved this - it seems I need to restart EG every time I make changes to the script - or manually close the WS connection (Not sure how to do that yet)

I am however still not receiving all the notifications I should.

Am I doing something wrong with this script or can it be done better?

Post Reply