Dear XSockets Team,
APEX has had
We have a simple controller running in a service that is created by using the topshelf plugin.
The controller is shown below:
namespace Apex.XSocket.Service.Controllers
{
public class MyController : XSocketController
{
public override async Task OnMessage(IMessage message)
{
await this.InvokeToAll(message);
}
public async Task Foo()
{
//Send a message to all clients with the topic 'say'
await this.InvokeToAll("Foo: Hello to all", "foo");
}
public async Task Bar(string message)
{
//Send out the message that was sent in to all clients
await this.InvokeToAll(string.Format("Bar: {0}", message), "bar");
}
}
}
Configuration is :
public class apexCSocketConfiguration : ConfigurationSetting
{
/// <summary>
/// Sample where we setup the server to run on localhost port 4506.
/// We can of course replace the IP with host name for example mydomain.com:4506
/// </Configuration>
public apexCSocketConfiguration()
{
string internaladdress = ConfigurationSettings.AppSettings["internaladdress"];
Uri uriDefault = new Uri(internaladdress);
this.Uri = uriDefault;
}
}
public class apexCSocketConfiguration2 : ConfigurationSetting
{
/// <summary>
/// Sample where we setup the server to run on localhost port 4506.
/// We can of course replace the IP with host name for example mydomain.com:4506
/// </Configuration>
public apexCSocketConfiguration2()
{
string externaladdress = ConfigurationSettings.AppSettings["externaladdress"];
Uri uriDefault = new Uri(externaladdress);
this.Uri = uriDefault;
}
}
}
This had been working fine then on Friday last week all Javascript access to the controllers stopped working with chrome, internet explorer and firefox.
The output from the service is shown below.
Configuration Result:
[Success] Name ApexXSocketService
[Success] Description XSockets Topshelf Host
[Success] ServiceName ApexXSocketService
Topshelf v3.2.150.0, .NET Framework v4.0.30319.42000
2015-10-19 14:33:25 [Information] License Information: LicenseTerms { LicenseType: Enterprise, Scaling: True, ConnectionLimit: -1, StartDate: 10/15/2015 00:00:00, EndDate: 04/15/2016 00:00:00, OwnerName: "APEX Communications", Corporate: "N/A", Address: "N/A", PostalCode: "N/A", City: "N/A", Country: "N/A", ProductName: "N/A", Id: 4c9b438b-fbf1-4371-92f5-ba79a42bfdaa, IsValid: True }
2015-10-19 14:33:25 [Information] Server starting at 10/19/2015 14:33:25 with interceptors True
2015-10-19 14:33:25 [Information] "Starting Endpoint with" { Origin: null, Host: "127.0.0.1", Port: 9091, IsLoopback: True, IsSecure: False, BacklogSize: 20, ThreadPoolSize: 200, CompletionPortThreads: 2, Certificate: null, CertificateLocation: 0, CertificateSubjectDistinguishedName: null, ForceClientCertificate: False }
2015-10-19 14:33:25 [Information] "Starting Endpoint with" { Origin: null, Host: "10.52.111.73", Port: 9090, IsLoopback: False, IsSecure: False, BacklogSize: 20, ThreadPoolSize: 200, CompletionPortThreads: 2, Certificate: null, CertificateLocation: 0, CertificateSubjectDistinguishedName: null, ForceClientCertificate: False }
The ApexXSocketService service is now running, press Control+C to exit.
2015-10-19 14:34:04 [Error] Caught exception in XSockets.Server
System.NullReferenceException: Object reference not set to an instance of an object.
at XSockets.Protocol.XWebSocketProtocol.Validate()
at XSockets.Protocol.Rfc6455.Rfc6455Protocol.<DoHandshake>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at XSockets.Core.XSocket.ProtocolHandshakeHandler.<HandShake>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at XSockets.Core.XSocket.ProtocolHandshakeHandler.<Read>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at XSockets.Core.XSocket.ProtocolHandshakeHandler.<Init>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at XSockets.Server.XSocketServer.<OnClientConnect>d__27.MoveNext()
The Javascript error is :
WebSocket connection to 'ws://127.0.0.1:9091/' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET
PuttyProtocol still works and I am able to connect.
If I run the demos that are available via GitHub (owin, MVC) javascript is able to connect to them without an issue.
The javascripts work and are able to connect to an XSockets 4.0.1 service we have running that we downloaded from chocolaty.
Ben Levy
public class apexCSocketConfiguration2 : ConfigurationSetting { public apexCSocketConfiguration2() : base(new Uri(ConfigurationManager.AppSettings["externaladdress"])){} }
public class apexCSocketConfiguration2 : ConfigurationSetting { public apexCSocketConfiguration2() { this.Uri = new Uri("ws://localhost:9393"); this.Origin = new HashSet<string>() { "*" }; } }