centrifuge icon indicating copy to clipboard operation
centrifuge copied to clipboard

client.send(data) disconnects clients on empty data

Open ArmanJR opened this issue 2 years ago • 1 comments

We have a problem with client.Send() method; in client.OnSubscribe() method, when data is empty, client.Send(data) causes our clients to disconnect. To prevent this, we have added a length check:

if chatAccesses := clientData.GetProtoChatAccessesData(); len(chatAccesses) > 0 {
    client.Send(chatAccesses)
}

But it is much better if Centrifuge checks it.

ArmanJR avatar Aug 16 '22 10:08 ArmanJR

Hello, I just tried to do it with Websocket/JSON case and centrifuge-js – and I don't observe disconnect, could you provide details about libs?

In general sending empty data may be a valid scenario in case of binary protocol format. So possibly simply rejecting empty data is not a way to go. But I'd like to understand which disconnect happens here.

FZambia avatar Aug 18 '22 06:08 FZambia

Closing since no response from the op and I have not been able to reproduce

FZambia avatar Nov 27 '22 12:11 FZambia