Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/imthaghost/chatserv

IRC server written in Go!
https://github.com/imthaghost/chatserv

chat cli go golang server tcp-server

Last synced: 7 days ago
JSON representation

IRC server written in Go!

Awesome Lists containing this project

README

        





A chatserver written in GO





gitmoji-changelog










### 📚 Table of Contents

1. [Deliverables](#deliverables)
2. [Getting Started](#getting-started)
3. [Local Development](#local-development)

## Deliverables

- [x] Single chat room
- [x] Users can connect to the server
- [x] Users can set their name
- [x] Users can send the message to the room
- [x] Users can see all other user's messages

## Installation

```sh
$ go get github.com/imthaghost/chatserv
```

## Getting Started

### server.go

```go
package main

import (
"github.com/imthaghost/chatserv/server"
)

func main() {
var s server.ChatServer
s = server.NewServer()
s.Listen(":3333")

// start the server
s.Start()
}
```

### client.go

```go
package main

import (
"flag"
"log"

"github.com/imthaghost/chatserv/client"
"github.com/imthaghost/chatserv/tui"
)

func main() {
address := flag.String("server", "", "Which server to connect to")

flag.Parse()

client := client.NewClient()
err := client.Dial(*address)

if err != nil {
log.Fatal(err)
}

defer client.Close()

// start the client to listen for incoming message
go client.Start()

tui.StartUi(client)
}
```

### Run

```sh
# we start the irc server
$ go run server.go
# in a new termnal window we start the client
$ go run client.go --server localhost:3333
```

## Demo

![Example](/docs/media/client.gif)

## Local Development

```sh
# inside github.com/imthaghost/server/ircserver
$ go run main.go
# inside github.com/imthaghost/tui/irc
$ go run main.go --server localhost:3333
```