GNOME Bugzilla – Bug 773253
websocket: add api to add a keepalive interval
Last modified: 2016-11-03 17:07:40 UTC
This will send ping messages in that interval of time so the connection is kept alive.
Created attachment 338071 [details] [review] websocket: add api to add a keepalive interval
*** Bug 773252 has been marked as a duplicate of this bug. ***
Created attachment 338590 [details] [review] websocket: add api to add a keepalive interval This will send ping messages in that interval of time so the connection is kept alive.
Comment on attachment 338590 [details] [review] websocket: add api to add a keepalive interval >+ * Interval in seconds on when to send a ping message which will >+ * serve as a keepalive message. If set to -1 the keepalive message is >+ * disabled. That immediately led me to ask "what if it's 0?" And it looks like it's disabled in that case too... maybe this should be a uint then, with "0" for disabled? >+ send_message (self, SOUP_WEBSOCKET_QUEUE_URGENT, 0x09, NULL, 0); Doesn't necessarily have to be done now, but we should have an enum for the opcodes... (If you do do it now, make it a separate patch.) Code looks good, but please add a test to tests/websocket-test.c.
Created attachment 338610 [details] [review] websocket: add api to add a keepalive interval This will send ping messages in that interval of time so the connection is kept alive.
Created attachment 338681 [details] [review] websocket: add api to add a keepalive interval This will send ping messages in that interval of time so the connection is kept alive.
This last version fixes 2 problems: 1. the ping message should be sent with the normal priority otherwise we might endup with mixed messages. 2. we should stop the ping message timeout right after sending close as the spec says that nothing should be sent after sending close.
Created attachment 338682 [details] [review] websocket: add api to add a keepalive interval This will send ping messages in that interval of time so the connection is kept alive.
Thanks for the reviews! Attachment 338682 [details] pushed as 6fcd8c5 - websocket: add api to add a keepalive interval