10 месяцев назад
История
Readme.md
Утилита проверки WebSocket подключения
Сборка
Возможно собрать под Linux, Windows, MacOS
make all
Использование
~ ./ws-ping_linux --help
Usage of ./ws-ping_linux:
-c string
WebSocket service address (default "localhost:8080")
-formatTime string
format time (default "15:04:05.000")
-message string
send message (default "Ping")
-sizeResponse int
size show message (default 100)
-timeout int
ping interval (seconds)
Если таймаут не задан, то сообщение уходит один раз:
~ ./ws-ping_linux -c wss://stream.binance.com/stream -message '{"method":"SUBSCRIBE","params":["!miniTicker@arr@3000ms"],"id":1}'
connecting to wss://stream.binance.com/stream
ping timeout: 0s
[13:21:03.582] -> {"method":"SUBSCRIBE","params":["!miniTicker@arr@3000ms"],"id":1}
[13:21:04.017] <- {"result":null,"id":1}
[13:21:05.464] <- {"stream":"!miniTicker@arr@3000ms","data":[{"e":"24hrMiniTicker","E":1708251663497,"s":"ETHBTC","c":...
[13:21:08.154] <- {"stream":"!miniTicker@arr@3000ms","data":[{"e":"24hrMiniTicker","E":1708251666464,"s":"ETHBTC","c":...
[13:21:11.162] <- {"stream":"!miniTicker@arr@3000ms","data":[{"e":"24hrMiniTicker","E":1708251670995,"s":"BTCUSDT","c"...
[13:21:14.172] <- {"stream":"!miniTicker@arr@3000ms","data":[{"e":"24hrMiniTicker","E":1708251671859,"s":"BNBBTC","c":...
[13:21:17.197] <- {"stream":"!miniTicker@arr@3000ms","data":[{"e":"24hrMiniTicker","E":1708251675978,"s":"LTCBTC","c":...
[13:21:20.184] <- {"stream":"!miniTicker@arr@3000ms","data":[{"e":"24hrMiniTicker","E":1708251677045,"s":"ETHBTC","c":...
[13:21:23.176] <- {"stream":"!miniTicker@arr@3000ms","data":[{"e":"24hrMiniTicker","E":1708251681171,"s":"BNBBTC","c":...
[13:21:26.228] <- {"stream":"!miniTicker@arr@3000ms","data":[{"e":"24hrMiniTicker","E":1708251683372,"s":"ETHBTC","c":...
⠈ live tm: 23s
^Cinterrupt
read: websocket: close 1000 (normal)
Finish, tm: 2024-02-18 13:21:27.285584588 +0300 MSK m=+25.115180444
При задании таймаута, сообщение заданное в message (по умолчанию “Ping”) отправляется регулярно с заданной периодичностью.
./ws-ping_linux -c wss://example.local/ws-api -timeout 1
connecting to wss://example.local/ws-api
ping timeout: 1s
[13:22:55.590] -> Ping
[13:22:55.618] <- Pong
[13:22:56.589] -> Ping
[13:22:56.602] <- Pong
[13:22:57.589] -> Ping
[13:22:57.633] <- Pong
[13:22:58.590] -> Ping
[13:22:58.649] <- Pong
[13:22:59.590] -> Ping
[13:22:59.610] <- Pong
License
Copyright 2024 Anton Dzyk
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Конвейеры
0 успешных
0 с ошибкой