Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/iamriteshkoushik/go.sock-server

A simple web-socket server implemented in Go lang for experimentation purposes.
https://github.com/iamriteshkoushik/go.sock-server

golang orderbook websocket-server

Last synced: 1 day ago
JSON representation

A simple web-socket server implemented in Go lang for experimentation purposes.

Awesome Lists containing this project

README

        

# WebSocket Orderbook (Simulated)

This project is an introduction to web-sockets using Go lang without using
any framework. It uses the standard packages and simulates an orderbook.

### Steps to run:
1. Repo setup
```go
git clone https://github.com/IAmRiteshKoushik/go.sock-server
cd go.sock-server
go mod tidy
```

2. Open two browsers side by side -> inspect element -> go to `console`
3. Type the following in both console:
```js
let socket = new WebSocket("ws://localhost:3000/orderbook")
```
```js
socket.onmessage = (event) => { console.log("Order received: ", event.data); }
```

You should see a stream of messages being sent to both instances of your browser
console at a one second interval.