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

Related tags

Websockets websocket
Overview

Описание

Сервис получает данные по киберспортивным матчам 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

You might also like...
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

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

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

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

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

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 (

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

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

Tiny WebSocket library for Go.

RFC6455 WebSocket implementation in Go.

Owner
null
Encrypted-websocket-chat - Encrypted websocket chat using golang

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

Artyom Artamonov 13 Sep 15, 2022
Websocket-chat - A simple websocket chat application

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

null 1 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

null 0 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.

SuperMario SuperFans 1 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

Joe Walnes 16.6k 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

Calogero Miraglia 0 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

Joshua Tracey 2 Dec 24, 2022
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

Sam Hennessy 93 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

Dong Nguyen 3 Apr 10, 2022
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

Gerasimos (Makis) Maropoulos 490 Dec 29, 2022