Skip to content

Instantly share code, notes, and snippets.

Avatar

Jan Korf JKorf

  • Meppel, Netherlands
View GitHub Profile
@JKorf
JKorf / gist:0c7789dce19e3639ece83db737c227a0
Last active May 23, 2022
Bybit socket keepalive interval sending incrementally more messages, resulting in increasing network usage even though the actual data being received is very limited
View gist:0c7789dce19e3639ece83db737c227a0
using System.Diagnostics;
using System.Net.WebSockets;
using System.Text;
var socket = new ClientWebSocket();
socket.Options.KeepAliveInterval = TimeSpan.FromSeconds(1);
socket.Options.SetBuffer(65536, 65536);
await socket.ConnectAsync(new Uri("wss://stream.bybit.com/spot/quote/ws/v2"), default);
var readThread = new Thread(async () =>
@JKorf
JKorf / program.cs
Created Feb 28, 2022
Binance socket response delay icw KeepAlive interval
View program.cs
using System.Diagnostics;
using System.Net.WebSockets;
using System.Text;
var socket = new ClientWebSocket();
socket.Options.KeepAliveInterval = TimeSpan.FromSeconds(15);
socket.Options.SetBuffer(65536, 65536); // Setting it to anything bigger than 65536 throws an exception in .net framework
await socket.ConnectAsync(new Uri("wss://stream.binance.com:9443/stream"), default);
var readThread = new Thread(async () =>