{"id":18962291,"url":"https://github.com/lipp/libwebsockets-exp","last_synced_at":"2026-04-02T01:30:18.327Z","repository":{"id":138883883,"uuid":"3534807","full_name":"lipp/libwebsockets-exp","owner":"lipp","description":"NOT REQUIRED ANY MORE.  modify libwebsocket to make binding it to Lua easier","archived":false,"fork":false,"pushed_at":"2012-02-24T10:49:30.000Z","size":996,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-01T05:17:04.736Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lipp.png","metadata":{"files":{"readme":"README-test-server","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-02-24T10:33:29.000Z","updated_at":"2014-05-10T06:17:07.000Z","dependencies_parsed_at":"2023-03-14T16:15:46.876Z","dependency_job_id":null,"html_url":"https://github.com/lipp/libwebsockets-exp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipp%2Flibwebsockets-exp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipp%2Flibwebsockets-exp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipp%2Flibwebsockets-exp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipp%2Flibwebsockets-exp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lipp","download_url":"https://codeload.github.com/lipp/libwebsockets-exp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239958310,"owners_count":19724926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T14:15:51.067Z","updated_at":"2026-04-02T01:30:18.145Z","avatar_url":"https://github.com/lipp.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Using test-server as a quickstart\n---------------------------------\n\nFor a Fedora x86_86 box, the following config line was\nneeded:\n\n ./configure --prefix=/usr --libdir=/usr/lib64 --enable-openssl\n\nFor Apple systems, Christopher Baker reported that this is needed\n(and I was told separately enabling openssl makes trouble somehow)\n\n./configure CC=\"gcc -arch i386 -arch x86_64\" CXX=\"g++ -arch i386 -arch\nx86_64\" CPP=\"gcc -E\" CXXCPP=\"g++ -E\" --enable-nofork\n\n\notherwise if /usr/local/... and /usr/local/lib are OK then...\n\n$ ./configure\n$ make clean\n$ make\n$ sudo make install\n$ libwebsockets-test-server\n\nshould be enough to get a test server listening on port 7861.\n\nThere are a couple of other possible configure options\n\n--enable-nofork\t\tdisables the fork into the background API\n\t\t\tand removes all references to fork() and\n\t\t\tpr_ctl() from the sources.  Use it if your\n\t\t\tplatform doesn't support forking.\n\n--enable-libcrypto\tby default libwebsockets uses its own\n\t\t\tbuilt-in md5 and sha-1 implementation for\n\t\t\tsimplicity.  However the libcrypto ones\n\t\t\tmay be faster, and in a distro context it\n\t\t\tmay be highly desirable to use a common\n\t\t\tlibrary implementation for ease of security\n\t\t\tupgrades.  Give this configure option\n\t\t\tto disable the built-in ones and force use\n\t\t\tof the libcrypto (part of openssl) ones.\n\n--with-client-cert-dir=dir   tells the client ssl support where to\n\t\t\t     look for trust certificates to validate\n\t\t\t     the remote certificate against.\n\n--enable-noping\t\tDon't try to build the ping test app\n\t\t\tIt needs some unixy environment that\n\t\t\tmay choke in other build contexts, this\n\t\t\tlets you cleanly stop it being built\n\t\t\t\n--enable-x-google-mux   Enable experimental x-google-mux support\n                        in the build (see notes later in document)\n\nTesting server with a browser\n-----------------------------\n\nIf you point your browser (eg, Chrome) to\n\n  http://127.0.0.1:7681\n\nIt will fetch a script in the form of test.html, and then run the\nscript in there on the browser to open a websocket connection.\nIncrementing numbers should appear in the browser display.\n\nUsing SSL on the server side\n----------------------------\n\nTo test it using SSL/WSS, just run the test server with\n\n$ libwebsockets-test-server --ssl\n\nand use the URL\n\n  https://127.0.0.1:7681\n\nThe connection will be entirely encrypted using some generated\ncertificates that your browser will not accept, since they are\nnot signed by any real Certificate Authority.  Just accept the\ncertificates in the browser and the connection will proceed\nin first https and then websocket wss, acting exactly the\nsame.\n\ntest-server.c is all that is needed to use libwebsockets for\nserving both the script html over http and websockets.\n\n\nForkless operation\n------------------\n\nIf your target device does not offer fork(), you can use\nlibwebsockets from your own main loop instead.  Use the\nconfigure option --nofork and simply call libwebsocket_service()\nfrom your own main loop as shown in the test app sources.\n\n\nTesting websocket client support\n--------------------------------\n\nIf you run the test server as described above, you can also\nconnect to it using the test client as well as a browser.\n\n$ libwebsockets-test-client localhost\n\nwill by default connect to the test server on localhost:7681\nand print the dumb increment number from the server at the\nsame time as drawing random circles in the mirror protocol;\nif you connect to the test server using a browser at the\nsame time you will be able to see the circles being drawn.\n\n\nTesting SSL on the client side\n------------------------------\n\nTo test SSL/WSS client action, just run the client test with\n\n$ libwebsockets-test-client localhost --ssl\n\nBy default the client test applet is set to accept selfsigned\ncertificates used by the test server, this is indicated by the\nuse_ssl var being set to 2.  Set it to 1 to reject any server\ncertificate that it doesn't have a trusted CA cert for.\n\n\nUsing the websocket ping utility\n--------------------------------\n\nlibwebsockets-test-ping connects as a client to a remote\nwebsocket server using 04 protocol and pings it like the\nnormal unix ping utility.\n\n$ libwebsockets-test-ping localhost                \nhandshake OK for protocol lws-mirror-protocol\nWebsocket PING localhost.localdomain (127.0.0.1) 64 bytes of data.\n64 bytes from localhost: req=1 time=0.1ms\n64 bytes from localhost: req=2 time=0.1ms\n64 bytes from localhost: req=3 time=0.1ms\n64 bytes from localhost: req=4 time=0.2ms\n64 bytes from localhost: req=5 time=0.1ms\n64 bytes from localhost: req=6 time=0.2ms\n64 bytes from localhost: req=7 time=0.2ms\n64 bytes from localhost: req=8 time=0.1ms\n^C\n--- localhost.localdomain websocket ping statistics ---\n8 packets transmitted, 8 received, 0% packet loss, time 7458ms\nrtt min/avg/max = 0.110/0.185/0.218 ms\n$\n\nBy default it sends 64 byte payload packets using the 04\nPING packet opcode type.  You can change the payload size\nusing the -s= flag, up to a maximum of 125 mandated by the\n04 standard.\n\nUsing the lws-mirror protocol that is provided by the test\nserver, libwebsockets-test-ping can also use larger payload\nsizes up to 4096 is BINARY packets; lws-mirror will copy\nthem back to the client and they appear as a PONG.  Use the\n-m flag to select this operation.\n\nThe default interval between pings is 1s, you can use the -i=\nflag to set this, including fractions like -i=0.01 for 10ms\ninterval.\n\nBefore you can even use the PING opcode that is part of the\nstandard, you must complete a handshake with a specified\nprotocol.  By default lws-mirror-protocol is used which is\nsupported by the test server.  But if you are using it on\nanother server, you can specify the protcol to handshake with\nby --protocol=protocolname\n\n\nFraggle test app\n----------------\n\nBy default it runs in server mode\n\n$ libwebsockets-test-fraggle\nlibwebsockets test fraggle\n(C) Copyright 2010-2011 Andy Green \u003candy@warmcat.com\u003e licensed under LGPL2.1\n Compiled with SSL support, not using it\n Listening on port 7681\nserver sees client connect\naccepted v06 connection\nSpamming 360 random fragments\nSpamming session over, len = 371913. sum = 0x2D3C0AE\nSpamming 895 random fragments\nSpamming session over, len = 875970. sum = 0x6A74DA1\n...\n\nYou need to run a second session in client mode, you have to\ngive the -c switch and the server address at least:\n\n$ libwebsockets-test-fraggle -c localhost \nlibwebsockets test fraggle\n(C) Copyright 2010-2011 Andy Green \u003candy@warmcat.com\u003e licensed under LGPL2.1\n Client mode\nConnecting to localhost:7681\ndenied deflate-stream extension\nhandshake OK for protocol fraggle-protocol\nclient connects to server\nEOM received 371913 correctly from 360 fragments\nEOM received 875970 correctly from 895 fragments\nEOM received 247140 correctly from 258 fragments\nEOM received 695451 correctly from 692 fragments\n...\n\nThe fraggle test sends a random number up to 1024 fragmented websocket frames\neach of a random size between 1 and 2001 bytes in a single message, then sends\na checksum and starts sending a new randomly sized and fragmented message.\n\nThe fraggle test client receives the same message fragments and computes the\nsame checksum using websocket framing to see when the message has ended.  It\nthen accepts the server checksum message and compares that to its checksum.\n\n\nproxy support\n-------------\n\nThe http_proxy environment variable is respected by the client\nconnection code for both ws:// and wss://.  It doesn't support\nauthentication yet.\n\nYou use it like this\n\nexport http_proxy=myproxy.com:3128\nlibwebsockets-test-client someserver.com\n\n\nWebsocket version supported\n---------------------------\n\nThe websocket client code is 04 and 05 version, the server\nsupports 00/76 in text mode and 04 and 05 dynamically\nper-connection depending on the version of the\nclient / browser.\n\n\nExternal Polling Loop support\n-----------------------------\n\nlibwebsockets maintains an internal poll() array for all of its\nsockets, but you can instead integrate the sockets into an\nexternal polling array.  That's needed if libwebsockets will\ncooperate with an existing poll array maintained by another\nserver.\n\nFour callbacks LWS_CALLBACK_ADD_POLL_FD, LWS_CALLBACK_DEL_POLL_FD,\nLWS_CALLBACK_SET_MODE_POLL_FD and LWS_CALLBACK_CLEAR_MODE_POLL_FD\nappear in the callback for protocol 0 and allow interface code to\nmanage socket descriptors in other poll loops.\n\n\nx-google-mux support\n--------------------\n\nExperimental and super-preliminary x-google-mux support is available if\nenabled in ./configure with --enable-x-google-mux.  Note that when changing\nconfigurations, you will need to do a make distclean before, then the new\nconfigure and then make ; make install.  Don't forget the necessary other\nflags for your platform as described at the top of the readme.\n\nIt has the following notes:\n\n    1) To enable it, reconfigure with --enable-x-google-mux\n    \n    2) It deviates from the google standard by sending full\n       headers in the addchannel subcommand rather than just\n       changed ones from original connect\n    \n    3) Quota is not implemented yet\n    \nHowever despite those caveats, in fact it can run the\ntest client reliably over one socket (both dumb-increment\nand lws-mirror-protocol), you can open a browser on the\nsame test server too and see the circles, etc.\n\nIt also works compatibly with deflate-stream automatically.\n\n2011-05-28  Andy Green \u003candy@warmcat.com\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flipp%2Flibwebsockets-exp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flipp%2Flibwebsockets-exp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flipp%2Flibwebsockets-exp/lists"}