WebSocket API problems

Hi.

I am trying to establish a connection using the websocket api, but it fails to connect when sending an request.

[Info]
Url: http://192.168.1.118:6680/mopidy/ws
JSON: {“jsonrpc”: “2.0”, “id”: 1, “method”: “core.playback.play”}

[Config]
[http]
enabled = true
hostname = 0.0.0.0
port = 6680
static_dir =
zeroconf = Mopidy HTTP server on $hostname

If I paste the url directly in the browser it says: Can “Upgrade” only to “WebSocket”.

Anyone know what I could be missing??

/Paw

I was really hoping that someone had a clue.

Is there any way I can test if the server is setup right??

Can anyone get this online service to work with their setup?

Thanks in advance

/Paw

It’s not clear what you are trying to do here, you cannot just paste a websocket address in your web browser and expect your browser to do anything useful with that. https://en.wikipedia.org/wiki/WebSocket

For testing, try Mopidy-API-Explorer.

Hi.

The final goal is to make a native Windows Phone App (or Xamarin) that communicates with Mopidy using RPC-Json 2.0 communication on websocket.

I have started a prototype trying requests like the one posted in the first message in this thread but it fails. So my best guess is that either my code doesn’t work or Mopidy is not set up properly. That is what I am trying to find out. I have a suspicion that that my Mopidy setup is not correctly done?

But I am a totally newbie in Mopidy so maybe I just got it wrong:-)

Let me try the Mopidy-API-Explorer. If this is working, as I understand you, this means that Mopidy is set up correctly and should be ready to communicate on my local network when calling from a Windows Phone app or similar.

/Paw

So yes, install that API-Explorer extension and try some of the examples it provides or just install one of the Web clients, if that is working then you know Mopidy’s http module is correctly configured and ready for you to use yourself. Either way I recommend you try out API-Explorer, I think it’s useful when starting out.