These are chat archives for synrc/n2o

1st
Apr 2017
Namdak Tonpa
@5HT
Apr 01 2017 01:26

The Right Way how to implement
STATEFUL XHR PROTOCOL in N2O
WORKING DRAFT by @5HT to be implemented by @seb3s

PREREQUISITES

You need to spawn n2o_async per each XHR request. You open n2o_stream and write 1 line of code in the XHR section. The name should be assigned with that process. The name is the cookie.

PROTOCOL

  1. Client sent it first request N2O, and died. n2o_async already started with timeout timer.
  2. Suppose client lost. Then we will see (on timer fired) when was the last message. If it is none or more than threshold — we kill the n2o_async process, otherwise — waits refreshing the timer by recreating.
  3. When client sends message with cookie already seen and corresponding n2o_async process is alive — we just send this message to n2o_async process. Updating the time of last message. Prolongation needed for stage 2.
  4. If it is not seen, i.e. it is first cookie — we need to create n2o_async. Goto 2.
  5. On PING message we just prolongate the value of last seen message inside n2o_async needed for stage 2.

NO SOCKJS IS NEEDED
NO MODIFICATION TO N2O.JS or BULLET.JS IS NEEDED

Namdak Tonpa
@5HT
Apr 01 2017 01:37
NOTE: Implemenation limit is 20 LOC.