chat

command module
v0.0.0-...-40d9c4a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

README

chat server

A very simple chat server using github.com/gorilla/websocket

  • a user can send a private message to another user
  • a user can broadcast a message to all users currently online

Build

In order to build/run the server:

$ go run main.go

Example

Use the client/client.go to connect to server and send a message.

$ cd client

# Start "user2" client
$ go run client.go "user2" "" ""

# Send a message "from user1" from "user1" to "user2"
$ go run client.go "user1" "user2" "from user1"

To broadcast a message to all connected users

$ cd client

# Start "user2" client
$ go run client.go "user2" "" ""

# Start "user3" client
$ go run client.go "user3" "" ""

# Broadcast a message "from user1" from "user1" to all connected users
$ go run client.go "user1" "GLOBAL" "from user1"

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL