{"id":25171254,"url":"https://github.com/basemax/typescriptchatwebsocket","last_synced_at":"2025-05-05T20:40:38.151Z","repository":{"id":184132386,"uuid":"667365282","full_name":"BaseMax/TypeScriptChatWebSocket","owner":"BaseMax","description":"This is a real-time chat application built with TypeScript and WebSocket, allowing users to communicate through direct messages, group messages, and channels. The application offers bidirectional communication between clients and the server, providing a seamless chat experience.","archived":false,"fork":false,"pushed_at":"2024-06-18T11:30:18.000Z","size":820,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-04T21:45:55.959Z","etag":null,"topics":["chat","javascript","js","ts","typescript","web-socket","websocket","ws"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BaseMax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-17T10:41:30.000Z","updated_at":"2024-05-20T21:28:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"bbaa37a3-2509-4cf4-b309-9e35bb948f73","html_url":"https://github.com/BaseMax/TypeScriptChatWebSocket","commit_stats":null,"previous_names":["basemax/typescriptchatwebsocket"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FTypeScriptChatWebSocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FTypeScriptChatWebSocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FTypeScriptChatWebSocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FTypeScriptChatWebSocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaseMax","download_url":"https://codeload.github.com/BaseMax/TypeScriptChatWebSocket/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252572850,"owners_count":21770099,"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":["chat","javascript","js","ts","typescript","web-socket","websocket","ws"],"created_at":"2025-02-09T09:19:42.535Z","updated_at":"2025-05-05T20:40:38.136Z","avatar_url":"https://github.com/BaseMax.png","language":"TypeScript","readme":"# TypeScript WebSocket Project\n\nThis is a real-time chat application built with TypeScript and WebSocket, allowing users to communicate through direct messages, group messages, and channels. The application offers bidirectional communication between clients and the server, providing a seamless chat experience.\n\n## Features\n\n- **User-to-User Direct Messaging:** Users can send direct messages to each other privately.\n- **Group Messaging:** Users can participate in group conversations with multiple participants.\n- **Channels:** Users can join and send messages to public channels.\n\n## Screenshots\n\n#### Start server\n\n![graphql](https://raw.githubusercontent.com/BaseMax/TypeScriptChatWebSocket/main/screenshots/Screenshot%20from%202023-07-29%2011-37-30.png)\n\n#### Login user\n\n![graphql](https://raw.githubusercontent.com/BaseMax/TypeScriptChatWebSocket/main/screenshots/Screenshot%20from%202023-07-29%2011-45-54.png)\n\n#### Send direct messages\n\n![graphql](https://raw.githubusercontent.com/BaseMax/TypeScriptChatWebSocket/main/screenshots/Screenshot%20from%202023-07-29%2011-40-00.png)\n\n#### Send group messages\n\n![graphql](https://raw.githubusercontent.com/BaseMax/TypeScriptChatWebSocket/main/screenshots/Screenshot%20from%202023-07-29%2011-44-04.png)\n\n#### Join and leave public channel\n\n![graphql](https://raw.githubusercontent.com/BaseMax/TypeScriptChatWebSocket/main/screenshots/Screenshot%20from%202023-07-29%2011-47-46.png)\n\n#### Retrieves user status (onilne, offline)\n\n![graphql](https://raw.githubusercontent.com/BaseMax/TypeScriptChatWebSocket/main/screenshots/Screenshot%20from%202023-07-29%2011-51-29.png)\n\n#### Retrieves user direct messages\n\n![graphql](https://raw.githubusercontent.com/BaseMax/TypeScriptChatWebSocket/main/screenshots/Screenshot%20from%202023-07-29%2011-51-58.png)\n\n## Prerequisites\n\nBefore running this project, ensure you have the following prerequisites installed on your system:\n\n- Node.js (\u003e=14.x)\n- npm (Node Package Manager)\n\n## Getting Started\n\nClone this repository to your local machine:\n\n```bash\ngit clone https://github.com/BaseMax/TypeScriptWebSocket\ncd TypeScriptWebSocket\n```\n\nInstall project dependencies:\n```bash\nnpm install\n```\n\n## Usage\n\n### Starting the WebSocket Server\n\n\nTo start the WebSocket server, run the following command:\n\n```bash\nnpm run start:server\n```\n\nThis will launch the server and bind it to a specified port (default is 8080). The server will be ready to accept WebSocket connections from clients.\n\n### Starting the WebSocket Client\n\nTo start the WebSocket client, run the following command:\n\n```bash\ncd client\n```\n\n```bash\nnpm run start:client\n```\n\nThe client will attempt to connect to the WebSocket server running on the specified host and port. You can adjust the server host and port in the `src/client.ts` file.\n\n## Chat Commands\n\nOnce the WebSocket client is running, you can use the following commands:\n\n- `/login \u003cusername\u003e`: Log in with your desired username to join the chat.\n- `/direct \u003cusername\u003e \u003cmessage\u003e`: Send a direct message to another user using their username.\n- `/group \u003cgroup_name\u003e \u003cmessage\u003e`: Send a message to a specific group of users.\n- `/join \u003cchannel_name\u003e`: Join a public chat channel to send and receive messages.\n- `/leave \u003cchannel_name\u003e`: Leave a public chat channel.\n\n### Socket commands or maybe routes:\n\n -`/api/login`: Handles user login. Expects a JSON payload with the username.\n- `/api/direct`: Sends a direct message. Expects a JSON payload with the recipient username and the message.\n- `/api/group`: Sends a message to a group. Expects a JSON payload with the group_name and the message.\n- `/api/channel/join`: Joins a public channel. Expects a JSON payload with the channel_name.\n- `/api/channel/leave`: Leaves a public channel. Expects a JSON payload with the channel_name.\n- `/api/channel/messages`: Retrieves the message history for a specific public channel.Expects a JSON payload with the channel_name.\n- `/api/user/status`: Retrieves the status (online, offline, etc.) of a specific user. Expects a JSON payload with the username.\n- `/api/user/direct-messages`: Retrieves the direct message history between the logged-in user and another user (:username).\n- `/api/user/groups`: Retrieves a list of groups that the logged-in user belongs to.\n\n### Handling WebSocket Events\n\nBoth the WebSocket server and client have event handlers for the following events:\n\n- `open`: Triggered when the WebSocket connection is successfully established.\n- `message`: Triggered when a message is received from the other party.\n- `close`: Triggered when the WebSocket connection is closed.\n\nYou can customize the behavior of these event handlers in the respective src/server.ts and src/client.ts files.\n\n## Configuration\n\nYou can modify the WebSocket server settings in the src/server.ts file:\n\n- `PORT`: The port on which the WebSocket server will listen for incoming connections.\n\nYou can adjust the WebSocket client settings in the src/client.ts file:\n\n- `SERVER_HOST`: The hostname or IP address of the WebSocket server.\n- `SERVER_PORT`: The port on which the WebSocket server is running.\n\n## Contributing\n\nContributions to this project are welcome. If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.\n\n## License\n\nThis project is licensed under the GPL-3.0 License.\n\nCopyright 2023, Max Base\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Ftypescriptchatwebsocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasemax%2Ftypescriptchatwebsocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Ftypescriptchatwebsocket/lists"}