A simple TCP client implementation for lichat
This is a simple, threaded, TCP-based client for the Lichat protocol.
Create a new client instance and pass it whatever settings you would like.
(defvar *client* (make-instance 'lichat-tcp-client:client))
Notable initargs of potential interest are:
:usernameThe name the client goes by on the network. Defaults to
:passwordThe password of the user profile, if any. Defaults to
:hostnameThe hostname to which the TCP socket should connect. The default is
:portThe port the TCP socket should connect to. The default is
Once a client exists, it can be started to attempt a connection to the server.
The client logs information via Verbose. If you set the REPL level to
:trace you should see a bunch of status messages being printed every now and again.
Once you're done with the client, you can shut it down again.
Naturally this client doesn't really do much on its own. You can send updates to the server with
(lichat-tcp-client:s *client* 'create :channel "test") (lichat-tcp-client:s *client* 'message :channel "test" :text "Hey.")
If you would like to respond to updates that the server sends back, you can define a method on
process to do so.
(defmethod lichat-tcp-client:process ((update lichat-protocol:join) (client lichat-tcp-client:client)) (lichat-tcp-client:s client 'message :channel (lichat-protocol:channel update) :text "What's up everyone?"))
See the Lichat protocol for more information on the available updates, their arguments, and their behaviour.
You can also try a minimal sample client by calling
mini-client. The client is meant to illustrate simple use of the library, so make sure to check out its source file,