public async Task <ClientWebSocket> CreateWriterAsync(int did, string tname, string qos) { assertConnection(); assertConnection(); var sn = nextSequenceNumber(); var ei = new EndpointInfo(did, tname, qos); var cmd = new CreateWriter(ei, sn); await sendCommand(cmd); var reply = await receiveReplyAsync(); Console.WriteLine("Reply: {eid: " + reply.b.eid + ", msg: " + reply.b.msg + "}"); if (reply.h.cid == CommandId.OK) { var wws = new ClientWebSocket(); // wws.Options.UseDefaultCredentials (); var uri = new Uri(url + writerPath + reply.b.eid); Console.WriteLine("Connecting Writer to: " + url + writerPath + reply.b.eid); await wws.ConnectAsync(uri, CancellationToken.None); Console.WriteLine("Connected Writer to: " + url + writerPath + reply.b.eid); return(wws); } else { return(null); } }
public async Task <WebSocket> CreateWriterAsync(int did, string tname, string qos) { assertConnection(); var sn = nextSequenceNumber(); var ei = new EndpointInfo(did, tname, qos); var cmd = new CreateWriter(ei, sn); await sendCommand(cmd, sn); var reply = await receiveReplyAsync(sn); Console.WriteLine("Reply: {eid: " + reply.b.eid + ", msg: " + reply.b.msg + "}"); if (reply.h.cid == CommandId.OK) { var uri = url + writerPath + reply.b.eid; var wws = new WebSocket(uri); Console.WriteLine("Connecting Writer to: " + url + writerPath + reply.b.eid); await ConnectWebSockAsync(wws); return(wws); } else { return(null); } }
public CreateReader(EndpointInfo ei, int sn) { h = new Header (CommandId.Create, EntityKind.DataReader, sn); b = ei; }
public CreateWriter(EndpointInfo ei, int sn) { h = new Header(CommandId.Create, EntityKind.DataWriter, sn); b = ei; }