- Using the Demo
Using the Demo
You'll want to open this application up in two tabs They can be on different browsers, on different machines or on completely different networks. Everything should work just the same.
Getting ready to receive data.
sub 0 to subscribe to channel 0. Since this channel name is an integer, the channel is automatically marked as binary. You can also type sub new_channel to subscribe to a text based channel to see how they're different.
On the other tab, type
pub 0 1 2 3 to send the bytes
0x0 0x1 0x2 to everyone subscribed to channel 0.
Kalisti provides a way to define channels. They're named like so;
The names are separated by colons, and are addressable individually or by selector. Selectors may contain wildcards (*), numerical wildcards (#) or ranges (0x0000-0xFFFF). Selectors may match to names or other selectors. Selector y would match selector x if and only if all individual names matches by y would also be matched by x. In other words, selector y matches selector x if it is a more specific version of x.
Messages may be published to a hub. Hubs have a set of channel selectors mapped to channel class names. The default mapping is simply
['*' => 'SeanMorris\Kalisti\Channel']. Since all channels names/selectors will match a bare
*, any channel can be created.The channel
SeanMorris\Kalisti\Channel will simply relay any messages to all subscribed agents.
The library is available on Packagist.
The library is available on npm.