This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Configuration; | |
using System.Linq; | |
using Microsoft.ServiceBus; | |
using Microsoft.ServiceBus.Messaging; | |
using XSockets.Core.Common.Enterprise; | |
using XSockets.Core.Common.Socket; | |
using XSockets.Core.Common.Socket.Event.Interface; | |
using XSockets.Core.Common.Utility.Logging; | |
using XSockets.Core.Common.Utility.Serialization; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace DataSyncBasic2.DataSync | |
{ | |
/// <summary> | |
/// Sync commands... Just to avoid string in code | |
/// </summary> | |
public static class DataSyncCommand | |
{ | |
public const string Add = "add"; | |
public const string Update = "update"; | |
public const string Delete = "delete"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Custom Logger Configuration in XSockets by implementing IDefaultLogger | |
public class MyLogger : IDefaultLogger | |
{ | |
public ILogger Logger | |
{ | |
get | |
{ | |
return new LoggerConfiguration().MinimumLevel.Verbose() | |
.WriteTo.XSockets() | |
.CreateLogger(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//client memeber is of type IXSocketClient that is connected to controller "foo" | |
//Read a dummy file from disk | |
var bytes = File.ReadAllBytes(@"c:\temp\HelloWorld.txt"); | |
//Create message with the custom helper "CreateBinaryMessage" and add the metadata of choice | |
var binaryMessage = client.CreateBinaryMessage(bytes, new FileInfo { FileName = "HelloWorld.txt" }); | |
//Send the binary message | |
client.Send(binaryMessage); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# XSockets 3.* Docs # | |
## Supported Platforms ## | |
### Server ### | |
XSockets runs pretty much anywhere and do note that the server ALWAYS deliver websocket-support. Feel free to compare us to alternative frameworks! | |
Platform Requirements Websockets WebRTC | |
Windows .NET 4+ Yes Yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// A really simple/stupid protocol. | |
/// The magic here is that clients connected to this protocol (TelNet, Arduino, Netduino or whatever) will be able | |
/// to communicate cross-protocol with client talking RFC6455 for example (or any other implemented protocol). | |
/// </summary> | |
public class SimpleProtocol : XSocketProtocol | |
{ | |
/// <summary> | |
/// Extract the path (controller name) from the handshake | |
/// </summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# XSockets 3.* Docs # | |
## Supported Platforms ## | |
### Server ### | |
XSockets runs pretty much anywhere and do note that the server ALWAYS deliver websocket-support. Feel free to compare us to alternative frameworks! | |
Platform Requirements Websockets WebRTC | |
Windows .NET 4+ Yes Yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Create a new XSockets text message.... the event is foo... The data is {lion:'grrr', p:Date()} | |
var myJson = new XSockets.Message("foo", { lion: 'grrr', p: Date() }); | |
//Create a XSockets binary message and attach the text to it... (we call canvasToBuffer() to get hold of some data) | |
var binaryMessage = new XSockets.BinaryMessage(myJson, canvasToBuffer(), | |
//The callback where we have data in the arrayBuffer... | |
function (arrayBuffer) { | |
// Okey, the buffer is created and wrapped in our simple "subprotocol".... send it! | |
ws.send(arrayBuffer.buffer); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyBinaryController : XSocketController | |
{ | |
public override void OnMessage(Core.Common.Socket.Event.Interface.IBinaryArgs binaryArgs) | |
{ | |
var bm = new BinaryMessage(binaryArgs); | |
this.Send(bm.BinaryArgs); | |
this.Send(bm.TextArgs); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// A module that lets you override the default behavior of incomming/outgoing messages | |
/// </summary> | |
public class MyPipeline : XSocketPipeline | |
{ | |
/// <summary> | |
/// A performance counter for messages | |
/// </summary> | |
private static readonly XSocketsMessageCounter MessageCounter; | |
NewerOlder