lichat ws server
1.0.0A simple WebSocket server implementation for lichat.
Table of Contents
About Lichat-WS-Server
This is a simple, threaded, WebSocket-based server for the Lichat protocol.
How To
Create a new server instance and pass it whatever settings you would like.
(defvar *server* (make-instance 'lichat-ws-server:server)) Notable initargs of potential interest are:
:nameThe name the server goes by on its own network. Defaults to(machine-instance).:hostnameThe hostname to which the TCP listener should bind. The default is0.0.0.0.:portThe port the TCP listener should listen on. The default is1111.:ping-intervalThe interval in which pings should be sent out to clients. The default is60.:saltThe salt with which passwords are hashed. The default is an empty string.:idle-timeoutThe number of seconds without a response from a client after which it is considered to have timed out. The default is120.:flood-frameThe size of a flood prevention frame. The default is30.:flood-limitThe number of allowed updates within a frame before flood limitation takes effect. The default is40.:connection-limitThe number of connections in total that the server supports before dropping incoming ones. The default is100.
Once a server exists, it can be started to listen to incoming connections:
(lichat-ws-server:open-connection *server*) The server 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 server, you can shut it down again.
(lichat-ws-server:close-connection *server*) Also See
- lichat-protocol The Lichat protocol specification.
- lichat-serverlib An agnostic implementation of the server-side protocol.
- lichat-tcp-server A basic, threaded, TCP-based implementation of a Lichat server.
System Information
Definition Index
-
LICHAT-WS-SERVER
- ORG.SHIRAKUMO.LICHAT.WS-SERVER
No documentation provided.-
EXTERNAL SPECIAL-VARIABLE *DEFAULT-PORT*
The standard port on which the server will run. Should be 1113.
-
EXTERNAL CLASS CHANNEL
Channel class. Access to the channel is properly handled for mutual exclusion from threads by its LOCK. Particularly, the following methods are mutually excluded via this lock: LICHAT-SERVERLIB:JOIN LICHAT-SERVERLIB:LEAVE See LICHAT-SERVERLIB:CHANNEL See LOCK
-
EXTERNAL CLASS CONNECTION
Connection class. Each connection to a client will have an instance of this class. Access to the connection is properly handled for mutual exclusion from threads by its LOCK. Particularly, the following methods are mutually excluded via this lock: LICHAT-SERVERLIB:SEND See LICHAT-SERVERLIB:FLOOD-PROTECTED-CONNECTION See HUNCHENSOCKET:WEBSOCKET-CLIENT See STATUS See LOCK
-
EXTERNAL CLASS SERVER
Server class. You should instantiate this. Access to the server is properly handled for mutual exclusion from threads by its LOCK. Particularly, the following updates and processing methods for updates are mutually excluded via this lock: LICHAT-SERVERLIB:TEARDOWN-CONNECTION LICHAT-PROTOCOL:CONNECT LICHAT-PROTOCOL:REGISTER LICHAT-PROTOCOL:CREATE See LICHAT-SERVERLIB:FLOOD-PROTECTED-SERVER See HUNCHENSOCKET:WEBSOCKET-RESOURCE See HOSTNAME See PORT See ACCEPTOR See THREAD See PING-INTERVAL See LOCK See CONNECTIONS
-
EXTERNAL CLASS USER
User class. Access to the user is properly handled for mutual exclusion from threads by its LOCK. Particularly, the following methods are mutually excluded via this lock: LICHAT-SERVERLIB:JOIN LICHAT-SERVERLIB:LEAVE See LICHAT-SERVERLIB:USER See LOCK
-
EXTERNAL GENERIC-FUNCTION CLOSE-CONNECTION
- SERVER
Stop accepting incoming connections and close all existing ones. See CONNECTIONS See THREAD See SERVER
-
EXTERNAL GENERIC-FUNCTION CONNECTION-LIMIT
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION (SETF CONNECTION-LIMIT)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION CONNECTIONS
- OBJECT
Accessor to the list of connections on the server. See SERVER See CONNECTION
-
EXTERNAL GENERIC-FUNCTION (SETF CONNECTIONS)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION HANDLE-PINGS
- SERVER
This function will loop on the server and send ping requests in a regular interval to clients that have not replied in a while. During the processing a restart called STOP-HANDLING is active that, when invoked, exits the function. See PING-INTERVAL See SERVER
-
EXTERNAL GENERIC-FUNCTION HOSTNAME
- OBJECT
Accessor to the hostname of the object. See SERVER
-
EXTERNAL GENERIC-FUNCTION (SETF HOSTNAME)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION LOCK
- OBJECT
Accessor to the lock of the object that is used to mutually exclude access. See SERVER See CONNECTION See USER See CHANNEL
-
EXTERNAL GENERIC-FUNCTION (SETF LOCK)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION OPEN-CONNECTION
- SERVER
Start accepting incoming connections on the server. This will launch a background thread which will call HANDLE-PINGS on the server. It will also construct and start the Hunchentoot acceptor of the server. See HANDLE-PINGS See THREAD See ACCEPTOR See SERVER
-
EXTERNAL GENERIC-FUNCTION PING-INTERVAL
- OBJECT
Accessor to the amount of seconds to wait for an update before sending a PING. See SERVER
-
EXTERNAL GENERIC-FUNCTION (SETF PING-INTERVAL)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION PORT
- OBJECT
Accessor to the port of the object. See SERVER See *DEFAULT-PORT*
-
EXTERNAL GENERIC-FUNCTION (SETF PORT)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION STATUS
- OBJECT
Accessor to the status of the connection. The value should be one of :STARTING :RUNNING :STOPPING See CONNECTION
-
EXTERNAL GENERIC-FUNCTION (SETF STATUS)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION THREAD
- OBJECT
Accessor to the background ping thread of the server. See SERVER
-
EXTERNAL GENERIC-FUNCTION (SETF THREAD)
- NEW-VALUE
- OBJECT
No documentation provided.