obs-websocket-community-projects / obs-websocket-js

Consumes https://github.com/obsproject/obs-websocket
MIT License
667 stars 96 forks source link

Adding handshakeTimeout support for Socket connect #175

Closed olafurw closed 1 year ago

olafurw commented 4 years ago

Description:

User can now provide timeout: [somenumber] as a connection attribute alongside address and password. This was needed because of intermittent connection problems and reconnection and the default timeout timer was too long.

olafurw commented 4 years ago

Cheers.

haganbmj commented 4 years ago

I'd rather just leave it open ended and do something like this where all of the unnecessary args are passed on to the underlying WebSocket.

obs.connect({
 address: 'localhost:4444',
 handshakeTimeout: 1000,
 whateverElse: 1
})

or

obs.connect({
 address: 'localhost:4444',
 options: {
    handshakeTimeout: 1000,
    whateverElse: 1
  }
})

That said, I need to sit down and just double check that this isn't a browser versus node compatibility issue. I'm seeing different constructors, but maybe isomorphic-ws can help with that too.

https://www.npmjs.com/package/ws https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/WebSocket

olafurw commented 4 years ago

Want me to PR it or are you going to look at it? I'd actually prefer the options separately since they could overlap with features in this lib.