Trying to start a Websocket #6317
Unanswered
espruino-discuss
asked this question in
ESP8266
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-11-27 by user105886
I'm trying to start a websocket server through the ESP8266 but keep receiving an error saying that Constructor should be a function and not undefined. This is my code after connecting the ESP to wifi. What is going wrong here? I have node and ws installed through terminal.
var WebSocketServer = require('ws').Server,
wss = new WebSocketServer({port:8080});
wss.on('connection', function (wss) {
wss.on('message', function (message) {
console.log('received: %s', message);
});
setInterval(
() => ws.send(
${new Date()}
),1000
);
});
Beta Was this translation helpful? Give feedback.
All reactions