Make client support ping
This commit is contained in:
parent
d46eec2e6d
commit
50ee261c0f
|
@ -11,6 +11,7 @@ const WS = activate require("@syndicate-lang/driver-websocket");
|
|||
const {
|
||||
Assert, Clear, Message,
|
||||
Add, Del, Msg,
|
||||
Ping, Pong,
|
||||
makeDecoder,
|
||||
} = activate require("./protocol");
|
||||
|
||||
|
@ -56,6 +57,8 @@ spawn named "BrokerClientFactory" {
|
|||
|
||||
on message ToBroker(url, $a) w(Message(a));
|
||||
|
||||
on message _BrokerPacket(url, Ping()) w(Pong());
|
||||
|
||||
during Observe(FromBroker(url, $spec)) {
|
||||
const ep = genUuid('sub');
|
||||
on start w(Assert(ep, Observe(spec)));
|
||||
|
|
|
@ -12,6 +12,10 @@ message type Add(endpointName, captures);
|
|||
message type Del(endpointName, captures);
|
||||
message type Msg(endpointName, captures);
|
||||
|
||||
// Bidirectional
|
||||
message type Ping();
|
||||
message type Pong();
|
||||
|
||||
function makeDecoder(initialBuffer) {
|
||||
return new Decoder(initialBuffer, {
|
||||
shortForms: {
|
||||
|
@ -25,5 +29,6 @@ function makeDecoder(initialBuffer) {
|
|||
Object.assign(module.exports, {
|
||||
Assert, Clear, Message,
|
||||
Add, Del, Msg,
|
||||
Ping, Pong,
|
||||
makeDecoder,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue