Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardalee committed Mar 10, 2024
1 parent 5db33e3 commit f36a2c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions examples/C/src/lib/WebSocketServer.lf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* initial_file = {= LF_SOURCE_DIRECTORY LF_FILE_SEPARATOR "filename.html" =}
* )
* ```

*
* When a connection is established with a client, an output is produced on the `connected` port
* that is a struct with a unique `wsi` (web socket interface) for the client and a boolean
Expand Down
10 changes: 4 additions & 6 deletions examples/C/src/lib/WebSocketServerString.lf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* This version is simpler to use than WebSocketServer. It is limited to a single connection at a
* time and to string-valued messages.
*
*
* If an `initial_file` parameter value is provided, it is expected to be a fully-qualified path to
* a file that this server will serve upon receiving an HTTP request. This can be used to provide
* the initial HTML (with embedded JavaScript) that will then establish a web socket connection to
Expand All @@ -17,6 +17,7 @@
* initial_file = {= LF_SOURCE_DIRECTORY LF_FILE_SEPARATOR "filename.html" =}
* )
* ```

*
* When a connection is established with a client, an output with value `true` is produced on the
* `connected` port. A value `false` is produced when the client disconnects.
Expand Down Expand Up @@ -47,10 +48,7 @@ target C

import WebSocketServer from "WebSocketServer.lf"

reactor WebSocketServerString(
hostport: int = 8000,
initial_file: string = {= NULL =}
) {
reactor WebSocketServerString(hostport: int = 8000, initial_file: string = {= NULL =}) {
input in_dynamic: char*
input in_static: string

Expand All @@ -60,7 +58,7 @@ reactor WebSocketServerString(
state ws: web_socket_instance_t

// Limit the number of clients to one.
server = new WebSocketServer(hostport=hostport, max_clients=1, initial_file = initial_file)
server = new WebSocketServer(hostport=hostport, max_clients=1, initial_file=initial_file)

reaction(startup) {=
self->ws.connected = false;
Expand Down

0 comments on commit f36a2c4

Please sign in to comment.