HandleError(ex)
soundPlayer.onopen = function (connection) {
console.log("Connected to XSockets using native IIS WebSockets.", connection);
};
soundPlayer.onerror = function (err) {
console.log(err);
};
try
{
throw new ArgumentException();
}
catch (Exception ex)
{
this.HandleError(ex);
}
public class Foo : XSocketController{ public Foo() { this.OnError += (sender, args) => { //Do whatever you want to do when a exception occurs on server side
//1. Log Composable.GetExport<IXLogger>().Error(args.Exception, "An exception occurred");
//2. Tell error interceptors ErrorInterceptorsQueue.Push(args.Exception);#if DEBUG //3. If in debug also tell the client... Might not do that in release since bad people could get more info than you want them to have this.Invoke(args.Exception.Message, XSockets.Core.Common.Globals.Constants.Events.Error);#endif }; }
public void Boom() { try { throw new Exception("Booooooom exception"); } catch (Exception ex) { //This will trigger the OnError event on the controller this.HandleError(ex); } }}
//using XSockets.Core.XSocket;
//using XSockets.Core.XSocket.Helpers;
try
{
var stocks = conn.Controller("stockticker").Invoke<IEnumerable<Stock>>("GetStocks");
foreach (Stock stock in stocks.Result)
{
Console.WriteLine("Symbol: {0} price: {1}", stock.Symbol, stock.Price);
}
}
catch (Exception ex)
{
Console.WriteLine("Error invoking GetStocks: {0}", ex.Message);
}