Подключение || Connection
Для подключения следует использовать Websocket-соединение по адресуwss://api.mikulski-radio.ru:6900
А также пройти условную авторизацию, отправив в течение первых 5 секунд после подключения, сообщение с паролем "groovy"
||
To connect, use a Websocket connection atwss://api.mikulski-radio.ru:6900
And also go through conditional authorization by sending a message with the password "groovy"
within the first 5 seconds after connection
//--NodeJS example--//
const WebSocket = require("ws");
const ws = new WebSocket("wss://api.mikulski-radio.ru:6900");
ws.on('open', (event)=>{
ws.send(JSON.stringify({password:"groovy"}))
});
ws.on('message', (event) => {
let data = JSON.parse(event)
console.log(data)
});
Общий тип сообщения JSON || The general type of the JSON message
Вид события и полезные данные || Event type and useful data
{ type: 'event_type', message: 'data' }
Типы событий || Types of events
- welcome – приветственное сообщение и результат авторизации || welcome message and authorization result
- current_track – текущий трек на Mikulski_Radio || current track on Mikulski_Radio
- songlist – сонглист || songlist
- current_viewers – текущее кол-во зрителей || current number of viewers
- next_stream – информация о дате следующего стрима || information about the date of the next stream
- stream_online – прямой эфир начался || livestream has started
- stream_offline – прямой эфир закончился || livestream is over
- chat_message – сообщение в чате || the message in the chat
- stream_event – событие на стриме || event on the stream
- boosty_news – пост на Boosty || a post on Boosty
- website_news – пост на mikulski.rocks|| a post on mikulski.rocks
- boosty_subs – список действующих подписчиков Boosty || list of current Boosty subscribers
- boosty_subs_goal – цель по подписчикам на Boosty || the goal for Boosty subscribers
- boosty_donation_goal – цель по сбору средств на Boosty || Boosty Fundraising goal
Примеры ответов || Examples of responses
welcome
{
type: 'welcome',
message: 'Добро пожаловать в Mikulski API! | Welcome to the Mikulski API!'
}
{ type: 'welcome', message: 'Successful authorization!' }
{ type: 'welcome', message: 'Authorization failed!' }
current_track
Отправка при обновлении данных || Sending when updating data
{ type: 'current_track', message: 'In Da Klub' }
songlist
Отправка при обновлении сонглиста || Sending when updating a songlist
{
type: 'songlist',
message: [
'133 Days',
'3 Years',
'4001',
... 1xx more items
]
}
current_viewers
Отправка каждую минуту || Sending every minute
{
type: 'current_viewers',
message: {
dlive: 3,
goodgame: 2,
icecast: 2,
kick: '?',
nuum: 1,
twitch: 1,
vk: 0,
vkvideolive: 1,
youtube: 0,
total: 10
}
}
next_stream
Если до стрима больше одного дня, то отправка происходит каждый час, затем каждые 10 минут, а в последний час до начала стрима – каждую минуту
||
If the stream is more than one day away, then it is sent every hour, then every 10 minutes, and in the last hour before the stream starts, every minute.
{
type: 'next_stream',
message: {
countdown: 'До стрима 1д 3ч ⏰ Until the stream 1d 3h',
timestamp: 1734789600,
date: '2024-12-21T14:00:00.000Z'
}
}
stream_online
{
type: 'stream_online',
message: `Mikulski has started stream | Мikulski начал стрим`
}
stream_offline
{
type:'stream_offline',
message: `Mikulski finished the stream | Мikulski закончил стрим`
}
chat_message
Новое сообщение в чате каждой площадки куда ретранслируется Mikulski_Radio
||
A new message in the chat of each site where Mikulski_Radio is relayed
{
type: 'chat_message',
message: '[GoodGame | Mikulski] Hello world!'
}
stream_event
Событие на стриме: отслеживание, рейд, донат и т.д.
||
Event on the stream: follow, raid, donation, etc.
{
type: 'stream_event',
message: 'Mikulski is now following Kick | Mikulski отслеживает Kick'
}
boosty_news
Новый пост на Boosty || New post on Boosty
{
type: 'boosty_news',
subtype: 'get',
message: '📼 Mikulski - "Sledge Hamster"\n' +
'https://boosty.to/mikulski/posts/abc44965-78c3-4b0d-a598-0a8ecf03446b'
}
website_news
Новый пост на mikulski.rocks || New post on mikulski.rocks
На английском || In English
{
type: 'website_news',
language: 'en',
message: 'The simplest chat logger for streams on ViewHub(NodeJS, without auth)\n' +
'---\n' +
'An illustrative example of a JS script for receiving messages from a stream chat on the ViewHub site. \n' +
'https://mikulski.rocks/the-simplest-chat-logger-for-streams-on-viewhubnodejs-without-auth/'
}
На русском || In Russian
{
type: 'website_news',
language: 'ru',
message: 'Простейший чат-логгер для стримов ViewHub (Nodejs, без авторизации)\n' +
'---\n' +
'Наглядный пример JS-скрипта для получения сообщений из стрим-чата на площадке ViewHub. \n' +
'https://mikulski.rocks/ru/viewhub-simple-chat-logger-ru/'
}
boosty_subs
Список действующих подписчиков Boosty, отправка при обновлении данных
||
List of active Boosty subscribers, sending when data is updated
{
type: 'boosty_subs',
message: [
'imsoslow', 'music_craft',
'yetig', 'SpaceMelodyLab',
'Mr Bean', 'unegalun',
'CrimsonCampfire', 'Nemo Nobody',
...
]
}
boosty_subs_goal
Отправка при обновлении данных || Sending when updating data
{
type: 'boosty_subs_goal',
message: { current: '21', target: '25', combined: '21 / 25' }
}
boosty_donation_goal
Отправка при обновлении данных || Sending when updating data
{
type: 'boosty_donation_goal',
message: {
currentRUB: '333',
targetRUB: '16177',
combinedRUB: '333 / 16177 RUB',
currentUSD: '3',
targetUSD: '166',
combinedUSD: '3 / 166 USD'
}
}
Запросы || Requests
Также можно получать данные по запросу.
Для этого нужно отправить на сервер сообщение с типом запрашиваемого события
||
You can also receive data on request.
To do this, you need to send a message to the server with the type of requested event:
ws.send(JSON.stringify({type:'songlist'});
Ответ повторяет формат регулярных сообщений за несколькими исключениями
||
The response repeats the format of regular messages with a few exceptions:
Добавляется ключ subtype:
со значением "get"
, чтобы была возможность отсеять регулярные сообщения от запрашиваемых
||
A subtype:
key is added with the value "get"
so that it is possible to filter out regular messages from the requested ones:
{ type: 'type_of_event', subtype: 'get', message: 'data' }
Запрос поста с вебсайта включает в себя последние посты на обоих языках в одном сообщении
||
The post request from the website includes the latest posts in both languages in a single message:
{
type: 'website_news', subtype: 'get',
message: {
en:`${websiteNewsEn}`,
ru:`${websiteNewsRu}`
}
}