WebAPI/SimplePush/Protocol: Difference between revisions

added section on ping.
(added section on ping.)
Line 85: Line 85:
the channelIDs it knows so the server may synchronize its state.
the channelIDs it knows so the server may synchronize its state.


The server is MAY respect this UAID, but it is at liberty to ask the UserAgent
The server MAY respect this UAID, but it is at liberty to ask the UserAgent
to change its UAID in the response.
to change its UAID in the response.


Line 128: Line 128:
==== PushServer -> UserAgent ====
==== PushServer -> UserAgent ====


PushServers MUST send only respond to a hello once.
PushServers MUST only respond to a hello once.
UserAgents MUST ignore multiple hello replies.
UserAgents MUST ignore multiple hello replies.


Line 194: Line 194:
     "channelID": "d9b74644-4f97-46aa-b8fa-9393985cd6cd",
     "channelID": "d9b74644-4f97-46aa-b8fa-9393985cd6cd",
     "status": 200,
     "status": 200,
     "pushEndpoint": "http://pushserver.example.org/"
     "pushEndpoint": "http://pushserver.example.org/d9b74644"
   }
   }


Line 258: Line 258:
     "status": 200
     "status": 200
   }
   }
=== Ping ===
The connection to the Push Server may be lost due to network issues. When the UserAgent detects loss of network, it should reconnect. There are situations in which the TCP connection dies without either end discovering it immediately. The UserAgent should send a ping approximately every 30 minutes andexpect a reply from the server in a reasonable time (The Mozilla UserAgent uses 10 seconds). If no data is received, the connection should be presumed closed and a new connection started.
The UserAgent should consider normal communications as an indication that the socket is working properly. It SHOULD send the ping packet only if no activity has occurred in the past 30 minutes.
==== UserAgent -> PushServer ====
The 2-character string <tt>{}</tt> is sent. This is a valid JSON object that requires no alternative processing on the server, while keeping transmission size small.
==== PushServer -> UserAgent ====
The PushServer may reply with any data. The UserAgent is only concerned about the state of the connection. The PushServer may deliver pending notifications or other information. If there is no pending information to be sent, it is RECOMMENDED that the PushServer also reply with the string <tt>{}</tt>.


=== Notification ===
=== Notification ===
Confirmed users
93

edits