Closed lhkzh closed 3 years ago
I see that changing the ws.publish("hh",message,isBinary)
line to ws.publish("hh",message,isBinary,true)
fixes the issue, something with not setting the compression parameter to true causing problem Segmentation fault (core dumped)
https://github.com/uNetworking/uWebSockets/blob/master/src/WebSocketContextData.h#L213
it helps to simplify the app to what still causes issue:
uws=require('uWebSockets.js')
uws.App().ws('/',{
compression:uws.DEDICATED_COMPRESSOR_3KB, // any dedicated compressor
open:ws=>{ws.subscribe('1');ws.publish('1','a')} // not setting compression parameter true = seg fault
}).listen(3000,()=>{})
new WebSocket("ws://localhost:3000")
yes.
What happens if you specify false?
false also throws error, must specify true to work
What happens if you specify false?
ws.publish('1','a'); core dump crash ws.publish('1','a',true); core dump crash ws.publish('1','a',true,false); core dump crash ws.publish('1','a',false,false); core dump crash ws.publish('1','a',true,true); success (need client support comporess ws.publish('1','a',false,true); success (need client support comporess
I can reproduce, not for SHARED_COMPRESSOR but with DEDICATED_COMPRESSOR. Something is wrong
Okay I see the issue - it's an old flaw that has never worked (and has not been caught in testing). You can work-around it by setting compress = true always, or use SHARED_COMPRESSOR. Will fix
yarn add uWebSockets.js@uNetworking/uWebSockets.js#v18.13.0
when client send, server publish then shutdown. server run windows10, node 14.5.0
server code
client code,run in chrome