A TCP server to host the game, which handles client connections.
Constructors
new(host, port)
Creates a TCP socket and spawns a fiber to wait for connections.
SourceClass methods
open(host, port, &)
Starts a server instance and yields it to the block.
SourceInstance methods
accept
Spawns a new handler fiber on each client connection.
Sourcebroadcast(msg, exclude = -1)
Broadcasts a message to all connected clients.
Does not send to exclude.
Sourceclient_reader(id, socket, channel, done)
Reads messages from the client.
Sourceclient_writer(id, socket, channel, done)
Writes messages to the client.
Sourceclose
Closes the server and all channels.
Sourcehandle_client(socket, id, channel)
Sends and receives messages from a client connection.
Sourcehide(id)
Tells the client to hide typed text.
Sourcerun
Runs main event loop which processes messages to and from clients
and then yields for game operations to take place.
Sourcesend(id, msg)
Sends a message to a specific connected client.
Sourceunhide(id)
Tells the client to unhide typed text.
Source