Handle pings

This commit is contained in:
Tony Garnock-Jones 2019-03-22 12:52:25 +00:00
parent 563ad1503a
commit 0d14510e82
2 changed files with 5 additions and 0 deletions

View File

@ -119,6 +119,7 @@ class Connection(object):
if protocol.Add.isClassOf(v): return self._lookup(v[0])._add(v[1])
if protocol.Del.isClassOf(v): return self._lookup(v[0])._del(v[1])
if protocol.Msg.isClassOf(v): return self._lookup(v[0])._msg(v[1])
if protocol.Ping.isClassOf(v): self._send(self._encode(protocol.Pong()))
def _send(self, bs):
raise Exception('subclassresponsibility')

View File

@ -11,6 +11,10 @@ Add = Record.makeConstructor('Add', 'endpointName captures')
Del = Record.makeConstructor('Del', 'endpointName captures')
Msg = Record.makeConstructor('Msg', 'endpointName captures')
## Bidirectional
Ping = Record.makeConstructor('Ping', '')
Pong = Record.makeConstructor('Pong', '')
## Standard Syndicate constructors
Observe = Record.makeConstructor('observe', 'specification')
Capture = Record.makeConstructor('capture', 'specification')