NAME
multiplexer - One-to-many communication with sockets.
SYNOPSIS
package require TTccll 88..22 package require llooggggeerr ::::mmuullttiipplleexxeerr::::ccrreeaattee$${{mmuullttiipplleexxeerriinnssttaannccee}}::::IInniitt port
$${{mmuullttiipplleexxeerriinnssttaannccee}}::::CCoonnffiigg key value
$${{mmuullttiipplleexxeerriinnssttaannccee}}::::AAddddFFiilltteerr cmdprefix
ccmmddpprreeffiixx data chan clientaddress clientport$${{mmuullttiipplleexxeerriinnssttaannccee}}::::AAddddAAcccceessssFFiilltteerr cmdprefix
ccmmddpprreeffiixx chan clientaddress clientport$${{mmuullttiipplleexxeerriinnssttaannccee}}::::AAddddEExxiittFFiilltteerr cmdprefix
ccmmddpprreeffiixx chan clientaddress clientportDESCRIPTION
The mmuullttiipplleexxeerr package provides a generic system for one-to-many com-
munication utilizing sockets. For example, think of a chat system where one user sends a message which is then broadcast to all the other connected users.It is possible to have different multiplexers running concurrently.
::::mmuullttiipplleexxeerr::::ccrreeaatteeThe ccrreeaattee command creates a new multiplexer 'instance'. For
example: This instance can then be manipulated like so:$${{mmuullttiipplleexxeerriinnssttaannccee}}::::IInniitt port
This starts the multiplexer listening on the specified port.
$${{mmuullttiipplleexxeerriinnssttaannccee}}::::CCoonnffiigg key value
Use CCoonnffiigg to configure the multiplexer instance. Configuration
options currently include: sseennddttoooorriiggiinn A boolean flag. If ttrruuee, the sender will receive a copy of the sent message. Defaults to ffaallssee. ddeebbuugglleevveellSets the debug level to use for the multiplexer instance,
according to those specified by the llooggggeerr package (debug, info, notice, warn, error, critical).$${{mmuullttiipplleexxeerriinnssttaannccee}}::::AAddddFFiilltteerr cmdprefix
Command to add a filter for data that passes through the multi-
plexer instance. The registered cmdprefix is called when dataarrives at a multiplexer instance. If there is more than one
filter command registered at the instance they will be called in the order of registristation, and each filter will get the result of the preceding filter as its argument. The first filter gets the incoming data as its argument. The result returned by the last filter is the data which will be broadcast to allclients of the multiplexer instance. The command prefix is
called as ccmmddpprreeffiixx data chan clientaddress clientport Takes the incoming data, modifies it, and returns that as its result. The last three arguments contain informationabout the client which sent the data to filter: The chan-
nel connecting us to the client, its ip-address, and its
ip-port.
$${{mmuullttiipplleexxeerriinnssttaannccee}}::::AAddddAAcccceessssFFiilltteerr cmdprefix
Command to add an access filter. The registered cmdprefix is called when a new client socket tries to connect to the multixerinstance. If there is more than one access filter command regis-
tered at the instance they will be called in the order of reg-
istristation. If any of the called commands returns -11 the
access to the multiplexer instance is denied and the client
channel is closed immediately. Any other result grants theclient access to the multiplexer instance. The command prefix
is called as ccmmddpprreeffiixx chan clientaddress clientport The arguments contain information about the client whichtries to connected to the instance: The channel connect-
ing us to the client, its ip-address, and its ip-port.
$${{mmuullttiipplleexxeerriinnssttaannccee}}::::AAddddEExxiittFFiilltteerr cmdprefix
Adds filter to be run when client socket generates an EOF condi-
tion. The registered cmdprefix is called when a client socketof the multixer signals EOF. If there is more than one exit fil-
ter command registered at the instance they will be called in the order of registristation. Errors thrown by an exit filter are ignored, but logged. Any result returned by an exit filter is ignored. The command prefix is called as ccmmddpprreeffiixx chan clientaddress clientport The arguments contain information about the client which signaled the EOF: The channel connecting us to theclient, its ip-address, and its ip-port.
KKEEYYWWOORRDDSSchat, multiplexer
multiplexer 0.2 multiplexer(n)