Websocket server. Get data from provider API, clean data and send to websoket, when it's changed.

Описание

Сервис получает данные по киберспортивным матчам CS:GO от провайдера, структурирует, очищает от лишнего и отправляет всем активным вебсокет клиентам, если призошли изменения с данными.

При первом подключении клиента отправляет актуальные данные Line и Upcoming.

Параметры хранит в переменных окружения. Описание в разделе "ENV"

Сборка бинарника

go build -o websocked ./cmd/*.go

ENV

Переменные окружения берутся из файла .env автоматически при запуске программы, если они не были определены ранее в ENV среды выполнения.

В данный момент в .env прописаны следующие значения:

$ tickers timeout for next request to provider

LIVE_TIMEOUT=3

UPCOMING_TIMEOUT=20

$ provider request URLs

LIVE_URL=https://.....

UPCOMING_URL=https://.....

$ field to marker json which are messaged to websocket

LIVE_JSON=live

UPCOMING_JSON=upcoming

$ websocket port

WS_ADDR=:8081

Что получаем а выходе

Сервер отправляет в вебсокет соединение структуры двух типов:

  1. Live - матчи, которые идут в данный момент в лайве. Тело сообщения содержит поле {"parameter":"live",......}
  2. Upcoming - предстоящие матчи. Тело сообщения содержит поле {"parameter":"upcoming",......}

Примеры ответов:

{"parameter":"live","body":[{"game_id":352722396,"game_start":1643463540, "game_oc_list":[{"oc_group_name":"1x2","oc_name":"Team Fryzex",...}],[{}],...}]}

{"parameter":"upcoming","body":[{"game_id":351424884,"game_start":1643472000, "game_oc_list":[{"oc_group_name":"1x2","oc_name":"Conquer",...}],[{}],...}]}

Проверка работы без внешних зависимостей

Можно использовать либо плагин для Chrome - Simple WebSocket Client, либо Postman.

По умолчанию доступ открыт на ws://localhost:8081/ws

Similar Resources

Websocket API Gateway that allows to subscribe on notifications about price changes of financial instruments

websocket-api-gateway Websocket API Gateway that allows to subscribe on notifications about price changes of financial instruments To test connection

Dec 5, 2021

Websocket market data capture utility for coinbase (written in Go)

mdcapture Websocket market data capture utility for coinbase (written in Go) Features Live subscription and capture of Coinbase market data Intended f

Jan 6, 2022

A fast, well-tested and widely used WebSocket implementation for Go.

Gorilla WebSocket Gorilla WebSocket is a Go implementation of the WebSocket protocol. Documentation API Reference Chat example Command example Client

Jan 2, 2023

Minimal and idiomatic WebSocket library for Go

websocket websocket is a minimal and idiomatic WebSocket library for Go. Install go get nhooyr.io/websocket Highlights Minimal and idiomatic API First

Dec 31, 2022

Go-distributed-websocket - Distributed Web Socket with Golang and Redis

Go-distributed-websocket - Distributed Web Socket with Golang and Redis

go-distributed-websocket Distributed Web Socket with Golang and Redis Dependenci

Oct 13, 2022

WebSocket Command Line Client written in Go

ws-cli WebSocket Command Line Client written in Go Installation go get github.com/kseo/ws-cli Usage $ ws-cli -url ws://echo.websocket.org connected (

Nov 12, 2021

proxy your traffic through CDN using websocket

go-cdn2proxy proxy your traffic through CDN using websocket what does it do example server client thanks what does it do you can use this as a library

Dec 7, 2022

Chat bots (& more) for Zoom by figuring out their websocket protocol

Chat bots (& more) for Zoom by figuring out their websocket protocol

zoomer - Bot library for Zoom meetings Good bot support is part of what makes Discord so nice to use. Unfortunately, the official Zoom API is basicall

Dec 14, 2022

Tiny WebSocket library for Go.

RFC6455 WebSocket implementation in Go.

Dec 28, 2022
Related tags
Encrypted-websocket-chat - Encrypted websocket chat using golang

Encrypted websocket chat First version written in python This version should be

Sep 15, 2022
Websocket-chat - A simple websocket chat application
Websocket-chat - A simple websocket chat application

WebSocket Chat App This is a simple chat app based on websockets. It allows user

Jan 25, 2022
API that upgrades connection to use websocket. Contains server and client and testing how they communicate

Websocket Test API How to execute First run server using: make run-server. Then run many client instances with: make run-client. Then start typing in

Dec 25, 2021
A simple server to convert ATK-IMU901 serial data into websocket stream

A simple server to convert ATK-IMU901 serial data into WebSocket stream.

Jan 31, 2022
Turn any program that uses STDIN/STDOUT into a WebSocket server. Like inetd, but for WebSockets.

websocketd websocketd is a small command-line tool that will wrap an existing command-line interface program, and allow it to be accessed via a WebSoc

Dec 31, 2022
BrisGolang is a Go implementation of the game of briscola using the WebSocket protocol for client/server communication.

BrisGolang BrisGolang is a Go implementation of the game of briscola using the WebSocket protocol for client/server communication. Usage You can play

Nov 1, 2021
Just a PubSub Websocket Server

Eventual Agent Just a PubSub Websocket Server The eventual agent allows cluster local apps to subscribe and publish over network. Goals Provide a WebS

Dec 24, 2022
HLive is a server-side WebSocket based dynamic template-less view layer for Go.
HLive is a server-side WebSocket based dynamic template-less view layer for Go.

HLive HLive is a server-side WebSocket based dynamic template-less view layer for Go. HLive is a fantastic tool for creating complex and dynamic brows

Jan 8, 2023
Websocket server, implemented flow Room style

ignite A websocket server module. Require redis to scale to multi nodes. Client/server message follow format type Message struct { Event string

Apr 10, 2022
A modern, fast and scalable websocket framework with elegant API written in Go
A modern, fast and scalable websocket framework with elegant API written in Go

About neffos Neffos is a cross-platform real-time framework with expressive, elegant API written in Go. Neffos takes the pain out of development by ea

Dec 29, 2022