-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read properties of undefined ( ws + nodejs ) #981
Comments
Hi @ruspaul013 Thanks for reaching out and sorry for the long delay in my response. We had lately another Node related issue and this one felt of the radar. Will pick it up again. You can have a look at the test application posted here https://github.com/nginx/unit/blob/master/test/node/loader/es_modules_websocket/app.mjs This test makes use of the loader you are using as well. The loader configuration can be found here Copied from our tests, can you give this a try? import http from "http"
import websocket from "websocket"
let server = http.createServer(function() {});
let webSocketServer = websocket.server;
server.listen(8080, function() {});
var wsServer = new webSocketServer({
maxReceivedMessageSize: 0x1000000000,
maxReceivedFrameSize: 0x1000000000,
fragmentOutgoingMessages: false,
fragmentationThreshold: 0x1000000000,
httpServer: server,
});
wsServer.on('request', function(request) {
var connection = request.accept(null);
connection.on('message', function(message) {
if (message.type === 'utf8') {
connection.send(message.utf8Data);
} else if (message.type === 'binary') {
connection.send(message.binaryData);
}
});
connection.on('close', function(r) {});
}); However as you can see we are using different imports. Can you try to use import http from "http"
import websocket from "websocket" as well? We will have to play around with |
Adding some info to the @tippexs reply. We do support only websockets for now. So you if you rewrite you demo app to something like:
then it should work with our Node module. |
@andrey-zelenkov thanks for adding this. I think we can be more explicit about what |
Hello @tippexs @andrey-zelenkov ! I know that |
Hello! Is there any support for ws planned?
I'm trying to use unit with ws and node loader in a demo app, but I still getting this error:
Demo app
index_ws.js file:
Config file
Unit config file:
Application with node it's working.
Environment
OS:
Unit version:
unit-http build local:
The text was updated successfully, but these errors were encountered: