modulepackage
0.0.0-20241028123550-29ca71d2153f
Repository: https://github.com/vkanhan/go-chat-anonymous.git
Documentation: pkg.go.dev
# README
Go chat anonymous
This is a simple chat server implemented in Go, allowing multiple clients to connect to different chat rooms and exchange messages.
Chat with your friends anonymously by typing the same secret key!
Features:
- Multiple Chat Rooms: Clients can join different chat rooms using a passkey.
- Broadcast Messaging: Messages sent by one client are broadcasted to all clients in the same chat room.
- Basic Command Handling: Clients can send messages and use the command "leave" to disconnect from the server.
Components:
main.go
: Entry point of the server, responsible for listening to incoming connections and managing client connections.server.go
: Manages the overall server operation, including handling new connections, client management, and message broadcasting.client.go
: Represents a connected client, handles client-specific operations such as message sending and disconnection.
Usage:
-
Clone the repository:
git clone https://github.com/Vkanhan/go-chat-anonymous.git cd go-chat-anonymous
-
Starting the Server:
- Run
go run main.go
to start the server. By default, it listens on port8080
.
- Run
-
Connecting Clients:
- Clients can connect to the server using any TCP client software (e.g., telnet, netcat).
- Connect to the server's IP address and port (e.g.,
telnet localhost 8080
). - Upon connection, clients are prompted to enter an anonymous name and a passkey to join a chat room.
-
Sending Messages:
- Clients can send messages to the chat room by typing their message. Messages are formatted as
passkey|name: message
.
- Clients can send messages to the chat room by typing their message. Messages are formatted as
-
Leaving the Chat:
- Clients can type
leave
to disconnect from the server and leave the chat room.
- Clients can type
License:
This project is licensed under the Apache License Version 2.0 LICENSE. See the LICENSE file for details.
# Functions
No description provided by the author
# Constants
No description provided by the author