Testing Websocket with Chrome Simple WebSocket Client

I have a brand new (July 5th, 2017) install of Volumio v2.201 up and running (except for ssh, which isn’t allowing logins - separate issue) and I’m trying to understand the WebSocket interface to write a driver for Crestron.

I’ve been trying to test the websocket interface using Chrome Simple Web Socket Interface, but it is not connecting. I have seen some reference to Volumio websocket using port 3000, but even that doesn’t work with Chrome’s UI. Chrome complains of “Simple WebSocket Client undefined”

Is it possible to use Chrome for testing the websocket interface? How?

Leave the Chrome thing alone… It never worked for me…
We’re using socket.io, use this:
appsaloon.github.io/socket.io-tester/

or even better… a cmd line client…
This doc will help :wink:
volumio.github.io/docs/API/WebSocket_APIs.html

That explains why it doesn’t work for me either.

The appsaloon sock.io-tester solution looks like it only has an OSX version available. My Mac is just for the music studio - no dev work on it. May have to try Tyrus and see if that works.

The end platform I’m trying to develop a solution for can’t use JavaScript, so any .js libraries won’t work. I have to write everything in their proprietary programming language called Simpl+, so I have to do everything through a inet socket interface.

I’ve already read the Volumio websocket api doc, but it doesn’t mention which port to use. Since the default port for websocket is 80, I would have assumed as much, but an example you posted in another post (websocket-home-automation-t4622.html) used port 3000, so now I’m not sure. 80 or 3000?

It seems at this point I have two routes to take. Port the libwebsocket C library to Simpl+ or somewhere get a copy of Crestron’s Simpl# C# library, which has websocket support, and create a websocket client C# library that I can link to Simpl+.

Wow you’ve a long road in front of you…
In any case both 80 and 3000 work.
Third option: use the good old REST API, its less complete than the Socket.io one, but for basic functionality it will work. And if somethng is not there, the code to add it is less relevant than writing websocket handler code (and could be a great contribution to the project).
Only downside, its not event based…

Doc (partial)
volumio.github.io/docs/API/REST_API.html

Rest api plugin:
github.com/volumio/Volumio2/blo … i/index.js

I’ve been trying to test the websocket interface to verify that it’s even running but not having any success. I’ve tried using curl as follows:

curl -i -N -H "GET / HTTP/1.1" -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: 192.168.1.19" -H "Origin: http://192.168.1.19" http://192.168.1.19

I get a:

curl: (52) Empty reply from server

I tried the websocket-io-tester from appsaloon.github.io and get no response.

I wrote a python script to test it:

[code]#!/usr/bin/env python3

import asyncio
import websockets

async def hello():
async with websockets.connect(‘ws://192.168.1.19’) as websocket:

    name = input("What's your name? ")
    await websocket.send(name)
    print("> {}".format(name))

    greeting = await websocket.recv()
    print("< {}".format(greeting))

asyncio.get_event_loop().run_until_complete(hello())
[/code]

It pukes with:

Traceback (most recent call last):
  File "/home/alan/.local/lib/python3.5/site-packages/websockets/client.py", line 79, in handshake
    status_code, headers = yield from read_response(self.reader)
  File "/home/alan/.local/lib/python3.5/site-packages/websockets/http.py", line 65, in read_response
    status_line, headers = yield from read_message(stream)
  File "/home/alan/.local/lib/python3.5/site-packages/websockets/http.py", line 83, in read_message
    start_line = yield from read_line(stream)
  File "/home/alan/.local/lib/python3.5/site-packages/websockets/http.py", line 107, in read_line
    raise ValueError("Line without CRLF")
ValueError: Line without CRLF

This all leads me to believe that the websocket plugin is not running / installed. It doesn’t show up in the Plugins menu on the web browser. Is there something that needs to be done to enable the websocket interface?

I’m running System Version 2.201 Released: Tue Jun 13 21:31:16 CEST 2017.