Hello,
I have a situation where I'm making two calls to useWebSocket: once in the root of a remix application, and another time further down the component tree
I am using the share: true option in both cases, and both have the same URL
// root.tsx
const Root() {
useWebSocket<MessageResponseType>(
'wss://example.com'
{
...otherOptions
heartbeat: {
message: JSON.stringify({ message: 'keep-alive' }),
interval: 60,
timeout: 120
},
share: true,
},
return <ChildrenComponents />
}
// children.tsx
const ChildrenComponents() {
useWebSocket<MessageResponseType>(
'wss://example.com'
{
...otherOptions,
share: true,
},
}
The problem here is, even though the child component is not passing the heartbeat option and the root component is, I am not seeing a heartbeat message
But then if I pass a heartbeat option the the child component, like so
// children.tsx
const ChildrenComponents() {
useWebSocket<MessageResponseType>(
'wss://example.com'
{
...otherOptions,
heartbeat: {
message: JSON.stringify({ message: 'keep-alive' }),
interval: 60,
timeout: 120
},
share: true,
},
}
Then I start to get two heartbeat messages. Ideally I would just be getting one heartbeat, and be able to share the connection
Any thoughts?
Hello,
I have a situation where I'm making two calls to
useWebSocket: once in the root of a remix application, and another time further down the component treeI am using the
share: trueoption in both cases, and both have the same URLThe problem here is, even though the child component is not passing the
heartbeatoption and the root component is, I am not seeing a heartbeat messageBut then if I pass a heartbeat option the the child component, like so
Then I start to get two heartbeat messages. Ideally I would just be getting one heartbeat, and be able to share the connection
Any thoughts?