tag:blogger.com,1999:blog-7763566905460067738.post7770059110470327730..comments2023-10-24T05:25:23.602-04:00Comments on Jacob Gable: MVC 3 Long Polling / "Comet" Chat ExampleJacob Gablehttp://www.blogger.com/profile/06143537581139815312noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-7763566905460067738.post-56715475189368602182021-10-30T09:11:34.678-04:002021-10-30T09:11:34.678-04:00The writer has outdone himself this time. It is no...The writer has outdone himself this time. It is not at all enough; the website is also utmost perfect. I will never forget to visit your site again and again. <a href="https://allotalk.net" rel="nofollow">Allo Talk</a><br />abdul quddoshttps://www.blogger.com/profile/04841832833907550885noreply@blogger.comtag:blogger.com,1999:blog-7763566905460067738.post-6540732718206080142013-04-09T10:28:39.137-04:002013-04-09T10:28:39.137-04:00nicenicemanishhttps://www.blogger.com/profile/13107835753673528019noreply@blogger.comtag:blogger.com,1999:blog-7763566905460067738.post-35254873234181904842012-12-03T09:49:53.216-05:002012-12-03T09:49:53.216-05:00That is an observable, from the reactive extension...That is an observable, from the reactive extensions framework. You may need to download the framework from here http://msdn.microsoft.com/en-us/data/gg577610.aspx.<br /><br />A Subject is just a source of events that we can subscribe to, in this case, it's a source of chat message events that fire every time a new message comes in.<br /><br />More info on Subject here: http://msdn.microsoft.com/en-us/library/hh229173(v=vs.103).aspxJacob Gablehttps://www.blogger.com/profile/06143537581139815312noreply@blogger.comtag:blogger.com,1999:blog-7763566905460067738.post-92024436819811454862012-12-02T07:09:33.131-05:002012-12-02T07:09:33.131-05:00I meant this :
private static Subject < Messa...I meant this :<br /><br /> private static Subject < MessageInfo > _messages = new Subject < MessageInfo >();<br />Anonymoushttps://www.blogger.com/profile/02968516048305488581noreply@blogger.comtag:blogger.com,1999:blog-7763566905460067738.post-51124792861741325382012-12-02T07:07:38.462-05:002012-12-02T07:07:38.462-05:00What exactly is this :
"private static Subje...What exactly is this :<br /><br />"private static Subject _messages = new Subject();"<br /><br />??<br /><br />My MVC app won't build and it finds an error with the Subject in that line of code.<br />Can you please tell me what "Subject" is and help me a little, to solve my problem ?Anonymoushttps://www.blogger.com/profile/02968516048305488581noreply@blogger.comtag:blogger.com,1999:blog-7763566905460067738.post-5458432623568832712012-01-27T09:43:54.307-05:002012-01-27T09:43:54.307-05:00Hi mate
Awesome stuff I am having a problem wher...Hi mate <br /><br />Awesome stuff I am having a problem where the messages don't always get back to the client they are getting to the service as I have them saved but some how they randomly dont get back to the client any ideas?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7763566905460067738.post-70709205237088580142011-09-09T17:41:33.908-04:002011-09-09T17:41:33.908-04:00Hi Christian,
I would probably send the user list...Hi Christian,<br /><br />I would probably send the user list along with the messages and just handle them in the client side.<br /><br />Try modifying the ChatResponse class to also pass back a list of new users (or the whole user list). If you go with just new users, you will probably want to send the current user list down when the page first loads.<br /><br />Once you've got the users coming back in the ChatResponse, update the getMessages javascript function in the Home/Index view to handle data.users as well as data.messages.<br /><br />Hope that helps. Otherwise, try to send me some code to my email address at jacob[dot]gable at gmail.Jacob Gablehttps://www.blogger.com/profile/06143537581139815312noreply@blogger.comtag:blogger.com,1999:blog-7763566905460067738.post-5807066491994684102011-09-08T16:45:35.549-04:002011-09-08T16:45:35.549-04:00I am trying to implement a userlist for the chat u...I am trying to implement a userlist for the chat using your asynchronous sample as a template. However I think maybe having a problem because i am now trying to handle two long polling asynchronous requests from one and the same page. Also I am not used to threading at all as I am a web developer so I am wondering if my approach is wrong, if I should send the userlist back in the same request as the messages? <br /><br />I am getting results on the client but I am pretty sure that the one long polling request is blocking the other as I tried to change the timeout to 5 seconds and the one side then pops up with my users every 5 seconds..<br /><br />Please help and give me a few hint on how to handle this... I am pretty stuck her :(David Schifferhttps://www.blogger.com/profile/17823582247569681496noreply@blogger.comtag:blogger.com,1999:blog-7763566905460067738.post-37225897292955157512011-08-23T14:42:39.382-04:002011-08-23T14:42:39.382-04:00That's a good question. Whether I should have...That's a good question. Whether I should have just used a closure, instead of passing the action as a parameter to the thread?<br /><br />In my experience, using closures in this type of scenario ends up giving you unexpected behavior. I think this is because C# Lambdas are "Lexical Closures" meaning they are not passed by value, but by reference. Therefore, when the reference changes (as in another call is made to that static method) the behavior will be different.<br /><br />When we pass the action as a parameter its value is then passed to use in the scope of the threadwait callback.<br /><br />Plus, in general, I'm a fan of this method because it keeps the waitcallback independent of outside "global" variables (like the closure). You can look at the code in the lambda and know exactly what it does because of the passed in parameter.Jacob Gablehttps://www.blogger.com/profile/06143537581139815312noreply@blogger.comtag:blogger.com,1999:blog-7763566905460067738.post-71478266044177602872011-08-23T12:55:21.398-04:002011-08-23T12:55:21.398-04:00Hello!
Great article! Can you please explain why ...Hello!<br /><br />Great article! Can you please explain why in the CheckForMessagesAsync function you call onMessages like<br />((Action>)parm)(msgs);<br /><br />instead of just write "onMessages(msgs);"? Is it because it will be called from another thread? But I don't know how it can be a problem here...<br /><br />Thanks.Евгенийhttps://www.blogger.com/profile/03275093455430613795noreply@blogger.com