You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constio=require('socket.io')(server)// being the server an https serverio.on('connection',(socket)=>{socket.send("hello");varsocketPort=newosc.WebSocketPort({socket:socket});socketPort.send({address: "/id",args: [{type: "s",value: "something"}]})varrelay=newosc.Relay(udpPort,socketPort,{})})
the udpPort is declared exactly as in the example and it is listening: it fires on readyand it receives osc messages. The https communication works like charm using ws
The clients prints the hello message but the socketPort sends an error:
'Can\'t send packets on a closed osc.Port object. Please open (or reopen) this Port by calling open().'
I tried adding socketPort.open() after its declaration, but socketPort.on("ready", ... never fires.
I'm sure that this is not a problem of your library, but are you maybe willing to help me?
By the way: Great job!
The text was updated successfully, but these errors were encountered:
Hi @davigega. I'm not a socket.io user, so I don't have a lot of background information to help with here. My best guess from reading your code and looking briefly at the documentation for socket.io is that you're trying to pass an instance of socket io's Socket class to osc.js's WebSocketPort. However, osc.js expects to receive a ws WebSocket object. Unless I'm misunderstanding something, you'll likely need to implement your own custom Port instance that uses socket.io to make this work.
Hello!
I am trying to rewrite the "Bidirectionl UDP <-> Web Browser" example (https://github.com/colinbdclark/osc.js-examples/blob/master/udp-browser/index.js) using the "socket.io" library instead of the "ws" one.
The differences are pretty small:
server side
the udpPort is declared exactly as in the example and it is listening: it fires on
ready
and it receives osc messages. The https communication works like charm usingws
client side
The clients prints the
hello
message but thesocketPort
sends an error:I tried adding
socketPort.open()
after its declaration, butsocketPort.on("ready", ...
never fires.I'm sure that this is not a problem of your library, but are you maybe willing to help me?
By the way: Great job!
The text was updated successfully, but these errors were encountered: