1

Just a heads up I am relatively new to nodeJs, websockets and stackoverflow,

I am using a websocket to send data to and from my javaScript front-end, this works without any issues, as does the websocket connection to Loriot initially.

However once I begin using the node websocket frequently the Loriot websocket stops receiving any data without triggering the .onclose or .onerror functions.

As no error or close is triggered re-opening the connection in the event of this isn't possible.

Anyone have any idea what may be causing this interference, thanks in advance?

var WebSocketServer = require('websocket').server;
var express         = require('express');
var app             = express();
var server          = app.listen(8888);
var wsServer        = new WebSocketServer({ httpServer : server });

const url = 'wss://eu4pro.loriot.io/***************************'
const loriotConnection = new WebSocket(url)

loriotConnection.onopen = function(event) {
console.log("Loriot WebSocket is open now.");
};

loriotConnection.onclose = function(event) {
console.log("Loriot WebSocket is CLOSED now.");

 };

loriotConnection.onerror = function(event) {
console.log('error')
}

loriotConnection.onmessage = e => {

 console.log(e.data)
}
  • The ping - pong method by Sarath Ak in https://stackoverflow.com/questions/26971026/handling-connection-loss-with-websockets resolved this issue – Joe Thompson Oct 29 '21 at 08:58

0 Answers0