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 {
|
const {
|
||||||
Assert, Clear, Message,
|
Assert, Clear, Message,
|
||||||
Add, Del, Msg,
|
Add, Del, Msg,
|
||||||
|
Ping, Pong,
|
||||||
makeDecoder,
|
makeDecoder,
|
||||||
} = activate require("./protocol");
|
} = activate require("./protocol");
|
||||||
|
|
||||||
|
@ -56,6 +57,8 @@ spawn named "BrokerClientFactory" {
|
||||||
|
|
||||||
on message ToBroker(url, $a) w(Message(a));
|
on message ToBroker(url, $a) w(Message(a));
|
||||||
|
|
||||||
|
on message _BrokerPacket(url, Ping()) w(Pong());
|
||||||
|
|
||||||
during Observe(FromBroker(url, $spec)) {
|
during Observe(FromBroker(url, $spec)) {
|
||||||
const ep = genUuid('sub');
|
const ep = genUuid('sub');
|
||||||
on start w(Assert(ep, Observe(spec)));
|
on start w(Assert(ep, Observe(spec)));
|
||||||
|
|
|
@ -12,6 +12,10 @@ message type Add(endpointName, captures);
|
||||||
message type Del(endpointName, captures);
|
message type Del(endpointName, captures);
|
||||||
message type Msg(endpointName, captures);
|
message type Msg(endpointName, captures);
|
||||||
|
|
||||||
|
// Bidirectional
|
||||||
|
message type Ping();
|
||||||
|
message type Pong();
|
||||||
|
|
||||||
function makeDecoder(initialBuffer) {
|
function makeDecoder(initialBuffer) {
|
||||||
return new Decoder(initialBuffer, {
|
return new Decoder(initialBuffer, {
|
||||||
shortForms: {
|
shortForms: {
|
||||||
|
@ -25,5 +29,6 @@ function makeDecoder(initialBuffer) {
|
||||||
Object.assign(module.exports, {
|
Object.assign(module.exports, {
|
||||||
Assert, Clear, Message,
|
Assert, Clear, Message,
|
||||||
Add, Del, Msg,
|
Add, Del, Msg,
|
||||||
|
Ping, Pong,
|
||||||
makeDecoder,
|
makeDecoder,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue