You are reading a single comment by @J{a}SON and its replies. Click here to read the full conversation.
  • when attempting to follow the websocket client example at, i get errors on the server (running node.js on a windows10 laptop) as:

    RangeError: Invalid WebSocket frame: RSV1 must be clear

    When I modify the code to use the npm ws client on the laptop, it works fine.

    node 8.9.4,
    "dependencies": {

    "express": "^4.16.3",
    "http": "0.0.0",
    "url": "^0.11.0",
    "ws": "^5.1.1"


    espruino wifi client:

    function wsConnect() {
        ws = new WebSocket(host, {path: '/', perMessageDeflate: false, port: 8080});
        ws.on('open', function() {
          // For WebSocket clients only
          console.log("Connected to server");
        ws.on('message', function(msg) {
          console.log("MSG: " + msg);
        ws.on('close', function() {
          console.log("Connection closed");
        ws.on('handshake', function() {
          console.log("Handshake Success");
        ws.on('ping', function() {
          console.log("Got a ping");
        ws.on('pong', function() {
          console.log("Got a pong");
        ws.on('rawData', function(msg) {
          console.log("RAW: " + msg);

    output on the repl is

    RAW: HTTP/1.1 101 Switching Protocols
    Upgrade: websocket
    Connection: Upgrade
    Sec-WebSocket-Accept: j5MohIRvl3Pm9AVPI+aTUTQIKxI=
    Handshake Success
    Connected to server
    RAW: something
    MSG: something
    RAW: something
    MSG: something
    Connection closed
    Connection closed


Avatar for J{a}SON @J{a}SON started