I'm trying to use websocket in my project. to do so, I installed the package Microsoft Asp.Net SignalR, which consists of WebSocketHandler abstract class. i defined a class inheriting WebSocketHandler, but then the compiler complains: 'Microsoft.AspNet.SignalR.WebSockets.WebSocketHandler' does not contain a constructor that takes 0 arguments'. It seems wierd to me, because the definitioin of WebSocketHandler ctor gets a nullable value, which means the ctor could get no parameter, the definition looks like this: protected WebSocketHandler(int? maxIncomingMessageSize);
can anybody tell me what the problem is? thanks.
Best How To :
protected member is accessible by derived class instances and there's nothing special about it. Nothing special in the class itself, either @ WebSocketHandler.cs.
It just mens you need to pass in a nullable type, it does not mean it can't get any arguments.
int? maxIncomingMessageSize = 0;
var socket = new WebSocketHandler(maxIncomingMessageSize);
In your derived class you could/should define a "constructor that takes 0 arguments".
public class MyHandler : WebSocketHandler
// not mandatory
public MyHandler(int? maxIncomingMessageSize)