socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

Add data as "sidecar" to heartbeat events

Open fzyzcjy opened this issue 4 years ago • 3 comments

I need to have some sidecar data that is sent along the heartbeat events. (Why I do this: Without doing this, I need to send those data as one single event, and it will cost much more resources for the server). However, it seems that currently the heartbeat cannot be customized, neither can I add some sidecar data to it.

Thanks for any suggestions!

fzyzcjy avatar Feb 16 '22 07:02 fzyzcjy

Yes, you are right, you cannot currently customize the heartbeat packet.

I'm not sure that's a good idea though, as it would deviate from the current protocol and break existing clients.

it will cost much more resources for the server

Could you please give some additional details? WebSocket connections are quite powerful for sending chunks of data.

darrachequesne avatar Feb 17 '22 05:02 darrachequesne

Could you please give some additional details? WebSocket connections are quite powerful for sending chunks of data.

Send/receive messages of websocket needs CPU, memory, logging, monitoring, etc for the server. So if I can combine two messages into one, then the cost can be less.

fzyzcjy avatar Feb 17 '22 06:02 fzyzcjy

I don't think we will implement this. Thanks!

darrachequesne avatar Jun 20 '23 14:06 darrachequesne