1

I want create method that will do some action when something added to the queue using AsyncController, here is my start:

public class AsyncTest : AsyncController
{
    public void LongPollAsync()
    {
        AsyncManager.OutstandingOperations.Increment();
        // search for messages and send them out...
        AsyncManager.OutstandingOperations.Decrement();
    }

    public ActionResult LongPollCompleted()
        {
        return Json();
    }
}
Zilberman Rafael
  • 1,341
  • 2
  • 14
  • 45
  • Use Websockets, as this is what they are made for, AJAX has way too much overhead. – Daniel W. Jan 04 '14 at 17:18
  • @DanFromGermany Can you please post an answer with examples how exactly to do this? – Zilberman Rafael Jan 04 '14 at 17:27
  • Where did you dug out `SocketController`? If you want comprehensible WebSocket tutorials follow this http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/tutorial-getting-started-with-signalr-20 SignalR are able to use WebSocket transport – testCoder Jan 05 '14 at 17:03
  • @testCoder `SocketController` is not real, it's just for example. Is teher any way to do this without using SignalR? – Zilberman Rafael Jan 05 '14 at 17:04
  • I only can give you links found by google, like this one: http://superwebsocket.codeplex.com/ or this one http://websocket4net.codeplex.com/ – Daniel W. Jan 05 '14 at 17:14
  • @DanFromGermany I don't want to use any external library, only `Microsoft` libraries. – Zilberman Rafael Jan 05 '14 at 17:15
  • Im not sure wether there are any WebSockets classes by Microsoft because basically websockets is a really simple protocol you would just open a TCP port and handle the data. Look at other related answers and google arround, you will find out how it works http://stackoverflow.com/questions/9119900/websockets-tutorial-on-asp-net – Daniel W. Jan 05 '14 at 17:18

0 Answers0