Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the lichat-tcp-client Reference Manual, version 1.0.0, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Apr 19 16:37:20 2021 GMT+0.
• Introduction | What lichat-tcp-client is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
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:
:username
The name the client goes by on the network. Defaults to (machine-instance)
.:password
The password of the user profile, if any. Defaults to NIL
.:hostname
The hostname to which the TCP socket should connect. The default is localhost
.:port
The port the TCP socket should connect to. The default is 1111
.Once a client exists, it can be started to attempt a connection to the server.
(lichat-tcp-client:open-connection *client*)
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.
(lichat-tcp-client:close-connection *client*)
Naturally this client doesn't really do much on its own. You can send updates to the server with s
:
(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.
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The lichat-tcp-client system |
Nicolas Hafner <shinmera@tymoon.eu>
Nicolas Hafner <shinmera@tymoon.eu>
(:git "https://github.com/shirakumo/lichat-tcp-client.git")
zlib
A simple TCP client implementation for lichat
1.0.0
lichat-tcp-client.asd (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The lichat-tcp-client.asd file | ||
• The lichat-tcp-client/package.lisp file | ||
• The lichat-tcp-client/client.lisp file | ||
• The lichat-tcp-client/documentation.lisp file |
Next: The lichat-tcp-client/package․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
lichat-tcp-client.asd
lichat-tcp-client (system)
Next: The lichat-tcp-client/client․lisp file, Previous: The lichat-tcp-client․asd file, Up: Lisp files [Contents][Index]
lichat-tcp-client (system)
package.lisp
Next: The lichat-tcp-client/documentation․lisp file, Previous: The lichat-tcp-client/package․lisp file, Up: Lisp files [Contents][Index]
package.lisp (file)
lichat-tcp-client (system)
client.lisp
Previous: The lichat-tcp-client/client․lisp file, Up: Lisp files [Contents][Index]
client.lisp (file)
lichat-tcp-client (system)
documentation.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The lichat-tcp-client package |
package.lisp (file)
org.shirakumo.lichat.tcp-client
common-lisp
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported special variables | ||
• Exported macros | ||
• Exported compiler macros | ||
• Exported functions | ||
• Exported generic functions | ||
• Exported classes |
Next: Exported macros, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
The default TCP port on which to connect. Should be 1111.
client.lisp (file)
Next: Exported compiler macros, Previous: Exported special variables, Up: Exported definitions [Contents][Index]
Shorthand macro to await a response from the server that matches the update generated in the INIT form.
See CALL-WITH-RESPONSE
client.lisp (file)
Next: Exported functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]
client.lisp (file)
Next: Exported generic functions, Previous: Exported compiler macros, Up: Exported definitions [Contents][Index]
Shorthand to construct an update to the server.
TYPE is coerced to a symbol from the LICHAT-PROTOCOL package.
It is then used together with the initargs to create an update
instance. A :FROM initarg using the client’s USERNAME is
automatically added.
See SEND
client.lisp (file)
Next: Exported classes, Previous: Exported functions, Up: Exported definitions [Contents][Index]
Calls the function once a suitable response update has appeared on the client’s stream.
A suitable response is either an UPDATE with the same ID
as the update returned by INIT, or an UPDATE-FAILURE with
the same UPDATE-ID as the ID of the updated returned by
INIT. If another message is found that does not match, it
is simply ignored.
See READ-MESSAGE
See LICHAT-PROTOCOL:UPDATE-FAILURE
See LICHAT-PROTOCOL:UPDATE
See LICHAT-PROTOCOL:ID
See LICHAT-PROTOCOL:UPDATE-ID
client.lisp (file)
Closes the connection to the server.
Attempts to be graceful by first sending a LICHAT-PROTOCOL:DISCONNECT update to the server, if it can.
See LICHAT-PROTOCOL:DISCONNECT
client.lisp (file)
Handles the incoming updates from the server.
This repeatedly (while the stream is open) calls READ-MESSAGE
and then passes that message on to PROCESS. If a connection
stability error occurs during this (timout, shutdown, reset, etc)
then HANDLE-FATAL-ERROR is called.
A restart called CLOSE-CONNECTION is active during this, which
allows you to gracefully exit and close the connection.
See PROCESS
See HANDLE-FATAL-ERROR
client.lisp (file)
This function is used to handle a fatal, aborting connection error.
You can use this to either simply close and exit, or to try
and reestablish a new connection.
See HANDLE-CONNECTION
client.lisp (file)
Initiate the connection from the client to the connection.
Implements the proper connection procedure as mandated by the
protocol in §4.1. If the connection fails, for whatever reason,
an error is signalled. If the connection succeeds, a background
thread is started that calls HANDLE-CONNECTION.
See HANDLE-CONNECTION
client.lisp (file)
Accessor to the password of the client, if any.
See CLIENT
See LICHAT-PROTOCOL:PASSWORD
(setf password) (generic function)
automatically generated reader method
client.lisp (file)
password (generic function)
automatically generated writer method
client.lisp (file)
Accessor to the TCP port the client is connecting over.
See CLIENT
(setf port) (generic function)
automatically generated reader method
client.lisp (file)
port (generic function)
automatically generated writer method
client.lisp (file)
This method is intended to be extended by user code and is called with any update received from the server.
Default methods exist for the following update types:
* LICHAT-PROTOCOL:PING – Automatically replies to the server
with a LICHAT-PROTOCOL:PONG update.
* LICHAT-PROTOCOL:DISCONNECT – Invoke the CLOSE-CONNECTION restart.
* T – Print the object via Verbose.
See HANDLE-CONNECTION
See LICHAT-PROTOCOL:PING
See LICHAT-PROTOCOL:DISCONNECT
client.lisp (file)
client.lisp (file)
client.lisp (file)
Reads wireables from the client’s stream until one can be read successfully.
This is to say, it will repeatedly try to read a message,
ignoring all LICHAT-PROTOCOL:WIRE-CONDITIONs until one can
be read without such an error. The message is returned.
See LICHAT-PROTOCOL:WIREABLE
See LICHAT-PROTOCOL:FROM-WIRE
See SOCKET-STREAM
client.lisp (file)
Send an update over the client connection to the server.
See LICHAT-PROTOCOL:TO-WIRE
See SOCKET-STREAM
client.lisp (file)
Accessor to the USOCKET:SOCKET instance that connects to the server.
See CLIENT
(setf socket) (generic function)
automatically generated reader method
client.lisp (file)
socket (generic function)
automatically generated writer method
client.lisp (file)
Accessor to the background processing thread of the client.
See CLIENT
(setf thread) (generic function)
automatically generated reader method
client.lisp (file)
thread (generic function)
automatically generated writer method
client.lisp (file)
Accessor to the username of the client.
See CLIENT
See LICHAT-PROTOCOL:USERNAME
(setf username) (generic function)
automatically generated reader method
client.lisp (file)
username (generic function)
automatically generated writer method
client.lisp (file)
Previous: Exported generic functions, Up: Exported definitions [Contents][Index]
Class to represent a Lichat client.
See USERNAME
See PASSWORD
See HOSTNAME
See PORT
See SOCKET
See THREAD
client.lisp (file)
standard-object (class)
:username
username (generic function)
(setf username) (generic function)
:password
password (generic function)
(setf password) (generic function)
:hostname
hostname (generic function)
(setf hostname) (generic function)
:port
port (generic function)
(setf port) (generic function)
:socket
socket (generic function)
(setf socket) (generic function)
:thread
thread (generic function)
(setf thread) (generic function)
Initarg | Value |
---|---|
:username | (machine-instance) |
:password | nil |
:hostname | "localhost" |
:port | lichat-tcp-client:*default-port* |
:thread | nil |
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal macros | ||
• Internal generic functions |
Next: Internal generic functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
Shorthand like WITH-RESPONSE that signals an error if the matching update is not of type LICHAT-PROTOCOL:UPDATE or of type LICHAT-PROTOCOL:FAILURE.
See WITH-RESPONSE
See LICHAT-PROTOCOL:FAILURE
See LICHAT-PROTOCOL:UPDATE
client.lisp (file)
Previous: Internal macros, Up: Internal definitions [Contents][Index]
Accessor to the TCP hostname the client is connecting to.
See CLIENT
(setf hostname) (generic function)
automatically generated reader method
client.lisp (file)
hostname (generic function)
automatically generated writer method
client.lisp (file)
Returns the stream of the socket of the client, if such is available.
See CLIENT
client.lisp (file)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L |
---|
Jump to: | F L |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | (
C F G H M O P R S T U W |
---|
Jump to: | (
C F G H M O P R S T U W |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | *
H P S T U |
---|
Jump to: | *
H P S T U |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | C L P S |
---|
Jump to: | C L P S |
---|