Snapshot của allinurl/gwsocket: 819★ · C · Backend. fast, standalone, language-agnostic WebSocket server RFC6455 compliant
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
gwsocket is a simple, standalone, language-agnostic, RFC6455 compliant
WebSocket Server, written in C. It sits between your application and the
client's browser, giving fast bidirectional communication between these two
with ease and flexibility. More info at:
https://gwsocket.io.
How it Works?
Very simple, just redirect the output from your application (stdout) to
stdin or to file (named pipe) and let gwsocket transfer the data to the
browser — That's it.
For example, tailing your server's logs into the browser couldn't be easier
You can also get the client's data into (stdin) your application. In fact,
you can even send your favorite ncurses program's output to the browser. See
screencast above.
Features
Message Fragmentation per section 5.4
UTF-8 Handling
Framing (Text & Binary messages)
Multiplexed non-blocking network I/O
Ability to pipe data in/out in two different modes (stdin/stdout & strict mode)
Origin-based restriction
It passes the Autobahn Testsuite :)
and of course, Valgrind tested
missing something?, please feel free to post it on Github.
Why gwsocket?
I needed a fast, simple, no-dependencies, no libraries,
RFC6455 compliant WebSocket Server written in C that I could use for
version 1.0 of GoAccess by simply piping data in
and out — WebSockets made easy!
More Examples?
gwsocket is language agnostic, look at the Man Page
for more details and examples on how to receive data from the browser and how
to send it to the browser.
Installation
Installing gwsocket is pretty easy. Just download, extract and compile it with:
$ wget https://tar.gwsocket.io/gwsocket-0.4.tar.gz
$ tar -xzvf gwsocket-0.4.tar.gz
$ cd gwsocket-0.4/
$ ./configure
$ make
# make install
No dependencies needed. How nice isn't it :), well almost, you need gcc, make, etc.
Build from GitHub
$ git clone s://github.com/allinurl/gwsocket.git
$ cd gwsocket
$ autoreconf -fiv
$ ./configure
$ make
# make install
Data Modes
In order to establish a channel between your application and the client's
browser, gwsocket provides two methods that allow the user to send data in and
out. The first one is through the use of the standard input (stdin), and the
standard output (stdout). The second method is through a fixed-size header
followed by the payload. See options below for more details.
STDIN/STDOUT
The standard input/output is the simplest way of sending/receiving data to/from
a client. However, it's limited to broadcasting messages to all clients. To
send messages to or receive from a specific client, use the strict mode in the
next section. See language specific examples here.
Strict Mode
gwsocket implements its own tiny protocol for sending/receiving data. In
contrast to the stdin/stdout mode, the strict mode allows you to
send/receive data to/from specific connected clients as well as to keep track
of who opened/closed a WebSocket connection. It also gives you the ability to
pack and send as much data as you would like on a single message. See language
specific examples here.
Command Line / Config Options
The following options can be supplied to the command line.
Command Line Option
Description
-p --port
Specifies the port to bind.
-h --help
Command line help.
-V --version
Display version information and exit.
--access-log=<path/file>
Specifies the path/file for the access log.
--addr=<addr>
Specifies the address to bind.
--echo-mode
Set the server to echo all received messages.
--max-frame-size=<bytes>
Maximum size of a websocket frame.
--origin=<origin>
Ensure clients send the specified origin header upon handshake.
--pipein=<path/file>
Creates a named pipe (FIFO) that reads from on the given path/file.
--pipeout=<path/file>
Creates a named pipe (FIFO) that writes to the given path/file.
--std
Enable --stdin and --stdout.
--stdin
Send stdin to the websocket.
--stdout
Send received websocket data to stdout.
--strict
Parse messages using strict mode. See man page for more details.
--ssl-cert=<cert.crt>
Path to SSL certificate.
--ssl-key=<priv.key>
Path to SSL private key.
--unix-socket=<addr>
Specify UNIX-domain socket address to bind server to.
Roadmap
Support for epoll and kqueue
Add more command line options
Add configuration file
Please feel free to open an issue to discuss a new feature.
License
MIT Licensed
Contributing
Any help on gwsocket is welcome. The most helpful way is to try it out and give
feedback. Feel free to use the Github issue tracker and pull requests to
discuss and submit code changes.
allinurl/gwsocket có 819 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/allinurl/gwsocket. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
allinurl/gwsocket có những chủ đề gì?
GitHub topics của allinurl/gwsocket: "c", "rfc-6455", "standalone", "websocket-server", "websockets". TopGit xếp repo vào nhóm Backend.
allinurl/gwsocket còn đang phát triển không?
Commit gần nhất trên allinurl/gwsocket là 4 tháng trước (theo timestamp GitHub). Repo có 72 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
allinurl/gwsocket viết bằng ngôn ngữ gì?
allinurl/gwsocket chủ yếu viết bằng C. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Cùng nhóm Backend còn repo nào?
allinurl/gwsocket thuộc nhóm Backend trên TopGit, cùng 5 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về allinurl/gwsocket ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/allinurl/gwsocket là nguồn chính thức.
Vì sao allinurl/gwsocket được xếp vào nhóm Backend?
TopGit xếp allinurl/gwsocket vào nhóm Backend dựa trên GitHub topics và mô tả của repo (gắn thẻ: "c", "rfc-6455", "standalone"). Việc phân loại dựa trên metadata thật của repo, không phải đoán theo cảm tính biên tập.
Đọc đầy đủ README ở tab phía trên.
Chưa chắc gwsocket có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về gwsocket.