The lichat-ws-server Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The lichat-ws-server Reference Manual

This is the lichat-ws-server Reference Manual, version 1.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 04:58:44 2022 GMT+0.

Table of Contents


1 Introduction

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:

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


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 lichat-ws-server

A simple WebSocket server implementation for lichat.

Maintainer

Nicolas Hafner <shinmera@tymoon.eu>

Author

Nicolas Hafner <shinmera@tymoon.eu>

Home Page

https://Shirakumo.github.io/lichat-ws-server/

Source Control

(GIT https://github.com/Shirakumo/lichat-ws-server.git)

Bug Tracker

https://github.com/Shirakumo/lichat-ws-server/issues

License

zlib

Version

1.0.0

Dependencies
  • lichat-protocol (system).
  • lichat-serverlib (system).
  • hunchensocket (system).
  • bordeaux-threads (system).
  • documentation-utils (system).
  • verbose (system).
Source

lichat-ws-server.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 lichat-ws-server/lichat-ws-server.asd

Source

lichat-ws-server.asd.

Parent Component

lichat-ws-server (system).

ASDF Systems

lichat-ws-server.


3.1.2 lichat-ws-server/package.lisp

Source

lichat-ws-server.asd.

Parent Component

lichat-ws-server (system).

Packages

lichat-ws-server.


3.1.3 lichat-ws-server/server.lisp

Dependency

package.lisp (file).

Source

lichat-ws-server.asd.

Parent Component

lichat-ws-server (system).

Public Interface
Internals

3.1.4 lichat-ws-server/documentation.lisp

Dependency

server.lisp (file).

Source

lichat-ws-server.asd.

Parent Component

lichat-ws-server (system).


4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 lichat-ws-server

Source

package.lisp.

Nickname

org.shirakumo.lichat.ws-server

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Special variables

Special Variable: *default-port*

The standard port on which the server will run.

Should be 1113.

Package

lichat-ws-server.

Source

server.lisp.


5.1.2 Generic functions

Generic Function: close-connection (server)

Stop accepting incoming connections and close all existing ones.

See CONNECTIONS
See THREAD
See SERVER

Package

lichat-ws-server.

Methods
Method: close-connection ((server server))
Source

server.lisp.

Generic Reader: connection-limit (object)
Package

lichat-ws-server.

Methods
Reader Method: connection-limit ((server server))

automatically generated reader method

Source

server.lisp.

Target Slot

connection-limit.

Generic Writer: (setf connection-limit) (object)
Package

lichat-ws-server.

Methods
Writer Method: (setf connection-limit) ((server server))

automatically generated writer method

Source

server.lisp.

Target Slot

connection-limit.

Generic Reader: connections (object)

Accessor to the list of connections on the server.

See SERVER
See CONNECTION

Package

lichat-ws-server.

Methods
Reader Method: connections ((server server))

automatically generated reader method

Source

server.lisp.

Target Slot

connections.

Generic Writer: (setf connections) (object)
Package

lichat-ws-server.

Methods
Writer Method: (setf connections) ((server server))

automatically generated writer method

Source

server.lisp.

Target Slot

connections.

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

Package

lichat-ws-server.

Methods
Method: handle-pings ((server server))
Source

server.lisp.

Generic Reader: hostname (object)

Accessor to the hostname of the object.

See SERVER

Package

lichat-ws-server.

Methods
Reader Method: hostname ((server server))

automatically generated reader method

Source

server.lisp.

Target Slot

hostname.

Generic Writer: (setf hostname) (object)
Package

lichat-ws-server.

Methods
Writer Method: (setf hostname) ((server server))

automatically generated writer method

Source

server.lisp.

Target Slot

hostname.

Generic Reader: lock (object)

Accessor to the lock of the object that is used to mutually exclude access.

See SERVER
See CONNECTION
See USER
See CHANNEL

Package

lichat-ws-server.

Methods
Reader Method: lock ((user user))

automatically generated reader method

Source

server.lisp.

Target Slot

lock.

Reader Method: lock ((channel channel))

automatically generated reader method

Source

server.lisp.

Target Slot

lock.

Reader Method: lock ((connection connection))

automatically generated reader method

Source

server.lisp.

Target Slot

lock.

Reader Method: lock ((server server))

automatically generated reader method

Source

server.lisp.

Target Slot

lock.

Generic Writer: (setf lock) (object)
Package

lichat-ws-server.

Methods
Writer Method: (setf lock) ((user user))

automatically generated writer method

Source

server.lisp.

Target Slot

lock.

Writer Method: (setf lock) ((channel channel))

automatically generated writer method

Source

server.lisp.

Target Slot

lock.

Writer Method: (setf lock) ((connection connection))

automatically generated writer method

Source

server.lisp.

Target Slot

lock.

Writer Method: (setf lock) ((server server))

automatically generated writer method

Source

server.lisp.

Target Slot

lock.

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

Package

lichat-ws-server.

Methods
Method: open-connection ((server server))
Source

server.lisp.

Generic Reader: ping-interval (object)

Accessor to the amount of seconds to wait for an update before sending a PING.

See SERVER

Package

lichat-ws-server.

Methods
Reader Method: ping-interval ((server server))

automatically generated reader method

Source

server.lisp.

Target Slot

ping-interval.

Generic Writer: (setf ping-interval) (object)
Package

lichat-ws-server.

Methods
Writer Method: (setf ping-interval) ((server server))

automatically generated writer method

Source

server.lisp.

Target Slot

ping-interval.

Generic Reader: port (object)

Accessor to the port of the object.

See SERVER
See *DEFAULT-PORT*

Package

lichat-ws-server.

Methods
Reader Method: port ((server server))

automatically generated reader method

Source

server.lisp.

Target Slot

port.

Generic Writer: (setf port) (object)
Package

lichat-ws-server.

Methods
Writer Method: (setf port) ((server server))

automatically generated writer method

Source

server.lisp.

Target Slot

port.

Generic Reader: status (object)

Accessor to the status of the connection.

The value should be one of :STARTING :RUNNING :STOPPING

See CONNECTION

Package

lichat-ws-server.

Methods
Reader Method: status ((connection connection))

automatically generated reader method

Source

server.lisp.

Target Slot

status.

Generic Writer: (setf status) (object)
Package

lichat-ws-server.

Methods
Writer Method: (setf status) ((connection connection))

automatically generated writer method

Source

server.lisp.

Target Slot

status.

Generic Reader: thread (object)

Accessor to the background ping thread of the server.

See SERVER

Package

lichat-ws-server.

Methods
Reader Method: thread ((server server))

automatically generated reader method

Source

server.lisp.

Target Slot

thread.

Generic Writer: (setf thread) (object)
Package

lichat-ws-server.

Methods
Writer Method: (setf thread) ((server server))

automatically generated writer method

Source

server.lisp.

Target Slot

thread.


5.1.3 Standalone methods

Method: check-message ((resource websocket-resource) (connection connection) opcode length total)
Package

hunchensocket.

Source

server.lisp.

Method: client-connected ((server server) (connection connection))
Package

hunchensocket.

Source

server.lisp.

Method: client-disconnected ((server server) (connection connection))
Package

hunchensocket.

Source

server.lisp.

Method: init-connection :around ((connection connection) update)
Package

lichat-serverlib.

Source

server.lisp.

Method: make-channel ((server server) &rest initargs)
Package

lichat-serverlib.

Source

server.lisp.

Method: make-connection ((server server) &rest initargs)
Package

lichat-serverlib.

Source

server.lisp.

Method: make-user ((server server) &rest initargs)
Package

lichat-serverlib.

Source

server.lisp.

Method: process :around ((connection connection) (update create))
Package

lichat-serverlib.

Source

server.lisp.

Method: process :around ((connection connection) (update register))
Package

lichat-serverlib.

Source

server.lisp.

Method: send ((object object) (connection connection))
Package

lichat-serverlib.

Source

server.lisp.

Method: send :around ((object object) (channel channel))
Package

lichat-serverlib.

Source

server.lisp.

Method: teardown-connection :around ((connection connection))
Package

lichat-serverlib.

Source

server.lisp.

Method: teardown-connection :after ((connection connection))
Package

lichat-serverlib.

Source

server.lisp.

Method: text-message-received ((server server) (connection connection) message)
Package

hunchensocket.

Source

server.lisp.


5.1.4 Classes

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

Package

lichat-ws-server.

Source

server.lisp.

Direct superclasses

backlogged-channel.

Direct methods
Direct slots
Slot: lock
Initform

(bordeaux-threads:make-recursive-lock)

Readers

lock.

Writers

(setf lock).

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

Package

lichat-ws-server.

Source

server.lisp.

Direct superclasses
  • flood-protected-connection.
  • websocket-client.
Direct methods
Direct Default Initargs
InitargValue
:usernil
Direct slots
Slot: lock
Initform

(bordeaux-threads:make-recursive-lock)

Readers

lock.

Writers

(setf lock).

Slot: status
Initform

:starting

Readers

status.

Writers

(setf status).

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

Package

lichat-ws-server.

Source

server.lisp.

Direct superclasses
  • flood-protected-server.
  • websocket-resource.
Direct methods
Direct Default Initargs
InitargValue
:name(machine-instance)
:hostnamelocalhost
:port*default-port*
:ping-interval10
:connection-limit100
:client-class(quote connection)
Direct slots
Slot: hostname
Initargs

:hostname

Readers

hostname.

Writers

(setf hostname).

Slot: port
Initargs

:port

Readers

port.

Writers

(setf port).

Slot: acceptor
Readers

acceptor.

Writers

(setf acceptor).

Slot: thread
Readers

thread.

Writers

(setf thread).

Slot: ping-interval
Initargs

:ping-interval

Readers

ping-interval.

Writers

(setf ping-interval).

Slot: lock
Initform

(bordeaux-threads:make-recursive-lock)

Readers

lock.

Writers

(setf lock).

Slot: connections
Readers

connections.

Writers

(setf connections).

Slot: connection-limit
Initargs

:connection-limit

Readers

connection-limit.

Writers

(setf connection-limit).

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

Package

lichat-ws-server.

Source

server.lisp.

Direct superclasses

user.

Direct methods
Direct slots
Slot: lock
Initform

(bordeaux-threads:make-recursive-lock)

Readers

lock.

Writers

(setf lock).


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Special variables

Special Variable: *servers*
Package

lichat-ws-server.

Source

server.lisp.


5.2.2 Ordinary functions

Function: dispatch-server (request)
Package

lichat-ws-server.

Source

server.lisp.


5.2.3 Generic functions

Generic Reader: acceptor (object)

Accessor to the Hunchentoot acceptor of the server.

See SERVER

Package

lichat-ws-server.

Methods
Reader Method: acceptor ((server server))

automatically generated reader method

Source

server.lisp.

Target Slot

acceptor.

Generic Writer: (setf acceptor) (object)
Package

lichat-ws-server.

Methods
Writer Method: (setf acceptor) ((server server))

automatically generated writer method

Source

server.lisp.

Target Slot

acceptor.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
A   C   D   F   G   H   I   L   M   O   P   S   T  
Index Entry  Section

(
(setf acceptor): Private generic functions
(setf acceptor): Private generic functions
(setf connection-limit): Public generic functions
(setf connection-limit): Public generic functions
(setf connections): Public generic functions
(setf connections): Public generic functions
(setf hostname): Public generic functions
(setf hostname): Public generic functions
(setf lock): Public generic functions
(setf lock): Public generic functions
(setf lock): Public generic functions
(setf lock): Public generic functions
(setf lock): Public generic functions
(setf ping-interval): Public generic functions
(setf ping-interval): Public generic functions
(setf port): Public generic functions
(setf port): Public generic functions
(setf status): Public generic functions
(setf status): Public generic functions
(setf thread): Public generic functions
(setf thread): Public generic functions

A
acceptor: Private generic functions
acceptor: Private generic functions

C
check-message: Public standalone methods
client-connected: Public standalone methods
client-disconnected: Public standalone methods
close-connection: Public generic functions
close-connection: Public generic functions
connection-limit: Public generic functions
connection-limit: Public generic functions
connections: Public generic functions
connections: Public generic functions

D
dispatch-server: Private ordinary functions

F
Function, dispatch-server: Private ordinary functions

G
Generic Function, (setf acceptor): Private generic functions
Generic Function, (setf connection-limit): Public generic functions
Generic Function, (setf connections): Public generic functions
Generic Function, (setf hostname): Public generic functions
Generic Function, (setf lock): Public generic functions
Generic Function, (setf ping-interval): Public generic functions
Generic Function, (setf port): Public generic functions
Generic Function, (setf status): Public generic functions
Generic Function, (setf thread): Public generic functions
Generic Function, acceptor: Private generic functions
Generic Function, close-connection: Public generic functions
Generic Function, connection-limit: Public generic functions
Generic Function, connections: Public generic functions
Generic Function, handle-pings: Public generic functions
Generic Function, hostname: Public generic functions
Generic Function, lock: Public generic functions
Generic Function, open-connection: Public generic functions
Generic Function, ping-interval: Public generic functions
Generic Function, port: Public generic functions
Generic Function, status: Public generic functions
Generic Function, thread: Public generic functions

H
handle-pings: Public generic functions
handle-pings: Public generic functions
hostname: Public generic functions
hostname: Public generic functions

I
init-connection: Public standalone methods

L
lock: Public generic functions
lock: Public generic functions
lock: Public generic functions
lock: Public generic functions
lock: Public generic functions

M
make-channel: Public standalone methods
make-connection: Public standalone methods
make-user: Public standalone methods
Method, (setf acceptor): Private generic functions
Method, (setf connection-limit): Public generic functions
Method, (setf connections): Public generic functions
Method, (setf hostname): Public generic functions
Method, (setf lock): Public generic functions
Method, (setf lock): Public generic functions
Method, (setf lock): Public generic functions
Method, (setf lock): Public generic functions
Method, (setf ping-interval): Public generic functions
Method, (setf port): Public generic functions
Method, (setf status): Public generic functions
Method, (setf thread): Public generic functions
Method, acceptor: Private generic functions
Method, check-message: Public standalone methods
Method, client-connected: Public standalone methods
Method, client-disconnected: Public standalone methods
Method, close-connection: Public generic functions
Method, connection-limit: Public generic functions
Method, connections: Public generic functions
Method, handle-pings: Public generic functions
Method, hostname: Public generic functions
Method, init-connection: Public standalone methods
Method, lock: Public generic functions
Method, lock: Public generic functions
Method, lock: Public generic functions
Method, lock: Public generic functions
Method, make-channel: Public standalone methods
Method, make-connection: Public standalone methods
Method, make-user: Public standalone methods
Method, open-connection: Public generic functions
Method, ping-interval: Public generic functions
Method, port: Public generic functions
Method, process: Public standalone methods
Method, process: Public standalone methods
Method, send: Public standalone methods
Method, send: Public standalone methods
Method, status: Public generic functions
Method, teardown-connection: Public standalone methods
Method, teardown-connection: Public standalone methods
Method, text-message-received: Public standalone methods
Method, thread: Public generic functions

O
open-connection: Public generic functions
open-connection: Public generic functions

P
ping-interval: Public generic functions
ping-interval: Public generic functions
port: Public generic functions
port: Public generic functions
process: Public standalone methods
process: Public standalone methods

S
send: Public standalone methods
send: Public standalone methods
status: Public generic functions
status: Public generic functions

T
teardown-connection: Public standalone methods
teardown-connection: Public standalone methods
text-message-received: Public standalone methods
thread: Public generic functions
thread: Public generic functions

Jump to:   (  
A   C   D   F   G   H   I   L   M   O   P   S   T