Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The issue is the default namespace SocketIO4Net is connecting &amp; registering with. The sort answer is to make a small change in the on.connect event handler: Add a new variable for a IEndPointClient (say icbit), and on the socket connection, connect with the "icbit" namespace. </p> <p>The SocketIO4Net default "On" handlers will handle namespace events as well, or you choose to register them directly with the given endpoint. (A single connection is made even with the additional namespace connection). You can read more about SO4N <a href="http://socketio4net.codeplex.com/wikipage?title=Namespace" rel="nofollow noreferrer">namespace</a></p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Net.Sockets; using System.Text; using System.Threading.Tasks; using SocketIOClient; using WebSocket4Net; namespace Console_ICBIT { public class SampleClient { private Client socket; private IEndPointClient icbit; private string authKey = "{your key here}"; private string userId = "{your user id here}"; public void Execute() { Console.WriteLine("Starting SocketIO4Net Client Events Example..."); string ioServer = string.Format("https://api.icbit.se/icbit?AuthKey={0}&amp;UserId={1}", authKey, userId); socket = new Client(ioServer); socket.Opened += SocketOpened; socket.Message += SocketMessage; socket.SocketConnectionClosed += SocketConnectionClosed; socket.Error += SocketError; // register for 'connect' event with io server socket.On("connect", (fn) =&gt; { // connect to namespace icbit = socket.Connect("/icbit"); icbit.On("connect", (cn) =&gt; icbit.Emit("message", new { op = "subscribe", channel = "orderbook_BUM3" })); }); // make the socket.io connection socket.Connect(); } void SocketOpened(object sender, EventArgs e) { Console.WriteLine("SocketOpened\r\n"); Console.WriteLine("Connected to ICBIT API server!\r\n"); } public void subscribe() { //conn.Emit("message", new { op = "subscribe", channel = "orderbook_BUH3" }); // for BTCUSD futures //conn.Emit("message", "{op = 'subscribe', channel = 'orderbook_3' }"); // for currency exchange section BTC/USD pair } void SocketError(object sender, ErrorEventArgs e) { Console.WriteLine("socket client error:"); Console.WriteLine(e.Message); } void SocketConnectionClosed(object sender, EventArgs e) { Console.WriteLine("WebSocketConnection was terminated!"); } void SocketMessage(object sender, MessageEventArgs e) { // uncomment to show any non-registered messages if (string.IsNullOrEmpty(e.Message.Event)) Console.WriteLine("Generic SocketMessage: {0}", e.Message.MessageText); else Console.WriteLine("Generic SocketMessage: {0} : {1}", e.Message.Event, e.Message.Json.ToJsonString()); } public void Close() { if (this.socket != null) { socket.Opened -= SocketOpened; socket.Message -= SocketMessage; socket.SocketConnectionClosed -= SocketConnectionClosed; socket.Error -= SocketError; this.socket.Dispose(); // close &amp; dispose of socket client } } } } </code></pre> <p>If you look at a websocket frame trace from a sample html page sample - you'll see it is using the "icbit" namespace: <img src="https://i.stack.imgur.com/2kAXx.png" alt="orderbook_BUH3"></p> <p>Please see if this small workaround doesn't fix you up...I look further into why the querystring params / namespace connection and post that on the project <a href="http://socketio4net.codeplex.com/" rel="nofollow noreferrer">site</a>.</p> <p>Jim</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload