{"id":20332797,"url":"https://github.com/bp7968h/rusty_socket","last_synced_at":"2025-10-18T06:42:43.748Z","repository":{"id":251121671,"uuid":"836447319","full_name":"bp7968h/rusty_socket","owner":"bp7968h","description":"Web socket protocol, server and client implementation in rust from scratch","archived":false,"fork":false,"pushed_at":"2024-10-23T22:15:34.000Z","size":95,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-14T15:43:10.173Z","etag":null,"topics":["base64","client-server","low-level-programming","sha1","websockets"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bp7968h.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-31T21:48:09.000Z","updated_at":"2024-11-14T11:14:15.000Z","dependencies_parsed_at":"2024-10-24T03:05:51.971Z","dependency_job_id":null,"html_url":"https://github.com/bp7968h/rusty_socket","commit_stats":null,"previous_names":["bp7968h/rusty_socket"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bp7968h%2Frusty_socket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bp7968h%2Frusty_socket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bp7968h%2Frusty_socket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bp7968h%2Frusty_socket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bp7968h","download_url":"https://codeload.github.com/bp7968h/rusty_socket/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241852131,"owners_count":20030966,"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":["base64","client-server","low-level-programming","sha1","websockets"],"created_at":"2024-11-14T20:28:21.548Z","updated_at":"2025-10-18T06:42:43.743Z","avatar_url":"https://github.com/bp7968h.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Web Socket Implementation in Rust\nThis is a learning attemp to implement web socket from scratch, including all the dependencies, which are implemented as a different library. With this `RFC 6455: The WebSocket Protocol` is implemented, including core protocol, server and client.\n\n[![Rusty Socket Demo](banner.png)](rusty_socket_example.mp4)\n\n## Overview\n\nWebSockets provide a full-duplex communication channel over a single TCP connection. This implementation handles establishing connections, exchanging messages, and managing different frame types as specified in the WebSocket protocol.\nFeatures\n\n- `Protocol Implementation`: Comprehensive implementation of the WebSocket protocol, handling frames, opcodes, handshakes, and error management.\n- `Server Implementation`: An extendable WebSocket server that accepts connections, manages clients, and broadcasts messages.\n- `Client Implementation`: A simple client that connects to the WebSocket server and can send and receive messages.\n\n## Core Libraries\n\n1. `rusty_socket_core`: Contains the core WebSocket protocol logic including frame parsing, opcodes, and utilities.\n2. `rusty_socket_client`: Implements the client-side functionalities, including establishing connections, sending messages, and handling responses.\n3. `rusty_socket_server`: Implements the server-side functionalities, including accepting client connections, broadcasting messages, and managing the server state.\n\n## Getting Started\n\n### Prerequisites\n\nMake sure you have Rust installed. You can install Rust by following the instructions from the [official Rust website](https://www.rust-lang.org/learn/get-started)..\n\n### Building the Project\nTo build the entire project, run:\n```bash\ncargo build --release\n```\n\n### Running the Example Server\nTo start the example server, navigate to the `example/server` directory and run:\n```bash\ncargo run\n```\nThe server will start listening on 127.0.0.1:8080. It will handle WebSocket handshake requests and maintain active connections with clients.\n\n### Running the Example Client\nTo run the client, navigate to the `example/client` directory and run:\n```bash\ncargo run\n```\nThe client can be used to connect to the example server and send or receive messages. Use commands like `connect`, `__disconnect`, `help`, and `exit` to control the client behavior.\n\n## Protocol Implementation Details\n\n- `Handshake`: The client initiates a WebSocket connection by sending an HTTP-based handshake request. The server responds with an appropriate handshake response if the connection is valid, upgrading the communication to WebSockets.\n- `Frames`: The protocol supports different opcodes such as Text, Binary, Ping, Pong, and Close. Frames are parsed and processed following the WebSocket protocol specifications.\n- `Error Handling`: Errors are managed with clear error messages, making it easier to debug issues during communication.\n\n## Example Usage\n\nHere’s a quick example of how to use the client to connect to the server:\n```bash\n---\u003cCommand Line Chat Initialized!\u003e---\n\u003e help\nUsage:\n\tconnect: Connect to the server\n\t__disconnect: Disconnect from the server\n\texit: Exit the program\n\thelp: Prints usage guide\n\u003e connect\nConnected successfully.\nmsg\u003e Hello from client 1\nrcv=\u003e Hello from client 1\nmsg\u003e rcv=\u003e Hello from client 2\nmsg\u003e __disconnect\nDisconnected successfully!\n\u003e exit\nExiting Program!\n```\n\n## Todo\n- Support frame fragmentation support.\n- Enhance error handling and logging.\n- Implement SSL/TLS support for wss:// connections.\n- Add more examples and comprehensive documentation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbp7968h%2Frusty_socket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbp7968h%2Frusty_socket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbp7968h%2Frusty_socket/lists"}