Message processing
XSockets is asynchronous and multi-threaded. This means that several messages can arrive at the controller (for a specific connection) simultaneously. In most cases this is fine, but we have had requests for functionality where the behavior should be single threaded per connection. By this we mean that only one message at the time should be processed in a controller instance.
So, we added a attribute named MessageProcessing
. This attribute takes a parameter of type MessageProcessingRule
. By default this is set to Asynchron
, but if you change it to Synchron
only one message at the time will be allowed to enter the controller.
using XSockets.Core.Common.Socket.Attributes;
using XSockets.Core.Common.Socket;
[MessageProcessing(MessageProcessingRule.Synchron)]
public class Foo : XSocketController
{
//Your methods here...
}