Back to Libwebsockets

Minimal Websocket test app

test-apps/test.html

4.5.82.3 KB
Original Source

|

| | ... | | |

| | Click Here to have the test server send a big picture by http. | |

Dumb Increment Demo

| Websocket connection not initialized | dumb increment-protocol | | The incrementing number is coming from the server at 20Hz and is individual for each connection to the server... try opening a second browser window.

The button sends a message over the websocket link to ask the server to zero just this connection's number. | |

| |

Mirror Demo

| Websocket connection not initialized | lws-mirror-protocol | | Use the mouse to draw on the canvas below -- all other browser windows open on this page see your drawing in realtime and you can see any of theirs as well.

The lws-mirror protocol doesn't interpret what is being sent to it, it just re-sends it to every other websocket it has a connection with using that protocol, including the guy who sent the packet.

libwebsockets-test-client joins in by spamming circles on to this shared canvas when run. | | Drawing color: BlackBlueGreenDark Red | |

|

Close Testing

| | | Websocket connection not initialized | Open and close testing | | To help with open and close testing, you can open and close a connection by hand using the buttons.
" Close" closes the connection from the browser with code 3000 and reason 'Bye!".
" Request Server Close" sends a message asking the server to initiate the close, which it does with code 1001 and reason "Seeya". | | | | |

Server info

| Websocket connection not initialized | Server Info | | This information is sent by the server over a ws[s] link and updated live whenever the information changes server-side. | |

| |

|

POST

| POST Form testing | | This tests POST handling in lws. | | FORM 1: send with urlencoded POST body args
Some text:

| | FORM 2: send with multipart/form-data
(can handle file upload, test limited to 100KB)
Some text:

|

|

Looking for support? https://libwebsockets.org, https://github.com/warmcat/libwebsockets
Join the mailing list: https://libwebsockets.org/mailman/listinfo/libwebsockets