mdevilliers / SignalR.RabbitMq

MessageBus implementation using RabbitMq as the backing store.
MIT License
89 stars 40 forks source link

what does the example do? #1

Closed wizaerd closed 12 years ago

wizaerd commented 12 years ago

I was asked by our development director to look into RabbitMQ and SignalR. I've downloaded the source from here, but I'm not exactly sure what the example is supposed to do. There is no readme describing what I'm supposed to do to get this going, nor again what it is supposed to do when it's run. I see classes in the example app called ChatHub and ChatTwo hub, so I assume it's some kind of chat program, but the only code in these classes are Send methods. So again, I have to ask, what is it supposed to do, and how can I better evaluate this to see if it fits our needs?

The need is to have some long running process on an app server that writes a periodic status update to a given queue. Instead of the webapp polling that queue for it's updates, I was told the SignalR aspect would push those updates to the webapp. Have I been incorrctly informed of what this does?

mdevilliers commented 12 years ago

Okay, the example is a ASP.NET MVC web application already set up with the basic SignalR example and yes its a chat-like example. If you have played with SignalR this will look very familiar to you.

Essentially load up the web app in Visual Studio, compile it and the start it (F5 for me). You should see a webpage with a text box where you can type messages. Open up another browser with the same url and you should be able to send messages from browser to browser.

It will look to connect to a local copy of RabbitMQ running with the default authentication (username - guest, password - guest). If you are using a different set up the code to change is in the Application_Start method in the global.asax.cs file. The connection/channel you configure is a standard RabbitMQ.Client connection.

I originally developed this do exactly what you want to do - so yes you can use this as part of a solution to what you want to achieve.

I hope that all makes sense,

Mark

wizaerd commented 12 years ago

I have done exactly that. Compiled the app, pressed F5 to run it, opened a second copy of the browser app at the same address and nothing gets sent between the two. In RabbitMQ, I can see the Exchange is created, but the system named queue is never called, and no messages go through the system.

We've been working a while with RabbitMQ, so know how it works, I just can't get this sample app to actually do anything.

On Thu, Sep 20, 2012 at 1:33 AM, mdevilliers notifications@github.comwrote:

Okay, the example is a ASP.NET MVC web application already set up with the basic SignalR example and yes its a chat-like example. If you have played with SignalR this will look very familiar to you.

Essentially load up the web app in Visual Studio, compile it and the start it (F5 for me). You should see a webpage with a text box where you can type messages. Open up another browser with the same url and you should be able to send messages from browser to browser.

It will look to connect to a local copy of RabbitMQ running with the default authentication (username - guest, password - guest). If you are using a different set up the code to change is in the Application_Start method in the global.asax.cs file. The connection/channel you configure is a standard RabbitMQ.Client connection.

I originally developed this do exactly what you want to do - so yes you can use this as part of a solution to what you want to achieve.

I hope that all makes sense,

Mark

— Reply to this email directly or view it on GitHubhttps://github.com/mdevilliers/SignalR.RabbitMq/issues/1#issuecomment-8720172.

mdevilliers commented 12 years ago

I suppose we had better try and narrow down the bit that isn't working.

If you put a breakpoint on the method public void Send(string message) in the ChatHub class. Does it ever get hit when you type a message in the browser?

If this works it would appear the SignalR bit is working.

Could you create a queue in RabbitMQ and add an extra binding to it from the Exchange. Go back to the browser, type in some chat messages, see if your breakpoint is hit, then see if your messages have been sent to your additional bound queue. If this works then the message are being broadcast to RabbitMq correctly.

wizaerd commented 12 years ago

No, neither the Send in ChatHub or the Send in ChatTwo hub ever get hit. Is there something I need to do for SignalR? The project has the DLLs for SignalR, although I hadn't done anything specifically with SignalR prior.

On Thu, Sep 20, 2012 at 11:53 AM, mdevilliers notifications@github.comwrote:

I suppose we had better try and narrow down the bit that isn't working.

If you put a breakpoint on the method public void Send(string message) in the ChatHub class. Does it ever get hit when you type a message in the browser?

If this works it would appear the SignalR bit is working.

Could you create a queue in RabbitMQ and add an extra binding to it from the Exchange. Go back to the browser, type in some chat messages, see if your breakpoint is hit, then see if your messages have been sent to your additional bound queue. If this works then the message are being broadcast to RabbitMq correctly.

— Reply to this email directly or view it on GitHubhttps://github.com/mdevilliers/SignalR.RabbitMq/issues/1#issuecomment-8741511.

mdevilliers commented 12 years ago

Cool looks like we are getting somewhere.

Its ok the dlls are downloaded when you do the first compile via nuget.

If you reload the web page in the browser either using Fiddler, Firebug or the web developer tools in Chrome or IE can you see any errors e.g. 404 in the Network tab or any javascript errors? Also if you are in Chrome or Firefox do you see anything logged to the console?

Just out of interest are you on Windows 8?

wizaerd commented 12 years ago

I feel pretty silly, I didn't even think to check that. In Chrome, in the Console I get:

Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://localhost:56739/signalr/hubs Uncaught TypeError: Cannot set property 'addMessage' of undefined

Windows 7 64bit

BTW, I appreciate your assistance in figuring this out.

Joe S.

On Thu, Sep 20, 2012 at 12:40 PM, mdevilliers notifications@github.comwrote:

Cool looks like we are getting somewhere.

Its ok the dlls are downloaded when you do the first compile via nuget.

If you reload the web page in the browser either using Fiddler, Firebug or the web developer tools in Chrome or IE can you see any errors e.g. 404 in the Network tab or any javascript errors? Also if you are in Chrome or Firefox do you see anything logged to the console?

Just out of interest are you on Windows 8?

— Reply to this email directly or view it on GitHubhttps://github.com/mdevilliers/SignalR.RabbitMq/issues/1#issuecomment-8742969.

mdevilliers commented 12 years ago

No problem.

I had a quick Google as its not an error I'd seen before and ended up here - http://stackoverflow.com/questions/11000293/mvc4-signalr-signalr-hubs-501-not-implemented-error

Can you give the last 2 post a read - either switching from the local development server or removing an installation of the mvc tools?

wizaerd commented 12 years ago

I'm already using IIS Express as opposed to the Visual Studio Development Server, but I got the same thing with full blown IIS. I'm hesitant to uninstall MVC though because we also develop MVC apps. I suppose I could just for sake of trying, and I'll let you know how it goes.

On Thu, Sep 20, 2012 at 1:21 PM, mdevilliers notifications@github.comwrote:

No problem.

I had a quick Google as its not an error I'd seen before and ended up here

http://stackoverflow.com/questions/11000293/mvc4-signalr-signalr-hubs-501-not-implemented-error

Can you give the last 2 post a read - either switching from the local development server or removing an installation of the mvc tools?

— Reply to this email directly or view it on GitHubhttps://github.com/mdevilliers/SignalR.RabbitMq/issues/1#issuecomment-8744224.

wizaerd commented 12 years ago

Oops, spoke too soon. Turns out I do not have Microsoft ASP.NET MVC 3 & 4

On Thu, Sep 20, 2012 at 1:29 PM, Joe aka Wizaerd wizaerd@gmail.com wrote:

I'm already using IIS Express as opposed to the Visual Studio Development Server, but I got the same thing with full blown IIS. I'm hesitant to uninstall MVC though because we also develop MVC apps. I suppose I could just for sake of trying, and I'll let you know how it goes.

On Thu, Sep 20, 2012 at 1:21 PM, mdevilliers notifications@github.comwrote:

No problem.

I had a quick Google as its not an error I'd seen before and ended up here -

http://stackoverflow.com/questions/11000293/mvc4-signalr-signalr-hubs-501-not-implemented-error

Can you give the last 2 post a read - either switching from the local development server or removing an installation of the mvc tools?

— Reply to this email directly or view it on GitHubhttps://github.com/mdevilliers/SignalR.RabbitMq/issues/1#issuecomment-8744224.

mdevilliers commented 12 years ago

Worth a go - like I say I haven't seen this error before.

I've had a look on the Signar issues list but can't see anything there except something about having .net4.5 installed?

Have you tried creating a signalr application from scratch following the instructions at https://github.com/SignalR/SignalR/wiki/QuickStart-Hubs It takes about 10 mins. This was the simplist signalr application I could find and the one I used to create the example application.

The only line you will need to change is the javascript include file to point to the current version of the downloaded signalr javascript file.

There is a signalr forum at http://jabbr.net/#/rooms/signalr where the guy who wrote it can help you with the signalr specific queries but he'll just ask you to create an app following the wiki.

wizaerd commented 12 years ago

Unfortunately, I am unable to do anything with SignalR. I downloaded the source, loaded it up and tried to build it, which fails on

Error 215 Could not copy the file "....\SignalR.Client.JS\bin\jquery.signalR.js" because it was not found. C:\Users\jsheble\Documents\Visual Studio 2012\Projects\SignalR - Actual\samples\SignalR.Hosting.AspNet.Samples\SignalR.Hosting.AspNet.Samples.csproj 280 5 SignalR.Hosting.AspNet.Samples Error 220 Could not copy the file "....\SignalR.Client.JS\bin\jquery.signalR.js" because it was not found. C:\Users\jsheble\Documents\Visual Studio 2012\Projects\SignalR - Actual\samples\SignalR.Hosting.Owin.Samples\SignalR.Hosting.Owin.Samples.csproj 236 5 SignalR.Hosting.Owin.Samples

Which is entirely accurate because there does not appear to be that specific file in the directory it's expected to copy from. This of course was after I initially attempted the QuickStart you linked me to, since I already had the DLLs. BTW, it's got to be the worst QuickStart ever since it assumes you've used SignalR before, because there's a whole lotta stuff left out of that "QuickStart".

I am not new to this, I've been a professional developer for well over 27 years, specifically with .NET since 1.1 came out, and yet this is eluding me.

On Thu, Sep 20, 2012 at 2:04 PM, mdevilliers notifications@github.comwrote:

Worth a go - like I say I haven't seen this error before.

I've had a look on the Signar issues list but can't see anything there except something about having .net4.5 installed?

Have you tried creating a signalr application from scratch following the instructions at https://github.com/SignalR/SignalR/wiki/QuickStart-Hubs It takes about 10 mins. This was the simplist signalr application I could find and the one I used to create the example application.

The only line you will need to change is

to

The current version I think is 0.5.3 but you you can check the file name of the downloaded signalr javascript file.

There is a signalr forum at http://jabbr.net/#/rooms/signalr where the guy who wrote it can help you with the signalr specific queries but he'll just ask you to create an app following the wiki.

— Reply to this email directly or view it on GitHubhttps://github.com/mdevilliers/SignalR.RabbitMq/issues/1#issuecomment-8745531.

wizaerd commented 12 years ago

I was eventually able to get a working SignalR app, but I am still unable to get the SignalR.RabbitMQ example to work, and it appears to stem around the "~/signalr/hubs" entry in the _Layout.cshtml. When I search around, the two different solutions (and only solutions) as far as I can see is to use @Url.Content("~/signalr/hubs") which I am using, and ensuring that the runAllManagedModulesForAllRequests is set to true in the web.config, which it is. Is there anything else you can think of that I can try?

On Thu, Sep 20, 2012 at 3:26 PM, Joe aka Wizaerd wizaerd@gmail.com wrote:

Unfortunately, I am unable to do anything with SignalR. I downloaded the source, loaded it up and tried to build it, which fails on

Error 215 Could not copy the file "....\SignalR.Client.JS\bin\jquery.signalR.js" because it was not found. C:\Users\jsheble\Documents\Visual Studio 2012\Projects\SignalR - Actual\samples\SignalR.Hosting.AspNet.Samples\SignalR.Hosting.AspNet.Samples.csproj 280 5 SignalR.Hosting.AspNet.Samples Error 220 Could not copy the file "....\SignalR.Client.JS\bin\jquery.signalR.js" because it was not found. C:\Users\jsheble\Documents\Visual Studio 2012\Projects\SignalR - Actual\samples\SignalR.Hosting.Owin.Samples\SignalR.Hosting.Owin.Samples.csproj 236 5 SignalR.Hosting.Owin.Samples

Which is entirely accurate because there does not appear to be that specific file in the directory it's expected to copy from. This of course was after I initially attempted the QuickStart you linked me to, since I already had the DLLs. BTW, it's got to be the worst QuickStart ever since it assumes you've used SignalR before, because there's a whole lotta stuff left out of that "QuickStart".

I am not new to this, I've been a professional developer for well over 27 years, specifically with .NET since 1.1 came out, and yet this is eluding me.

On Thu, Sep 20, 2012 at 2:04 PM, mdevilliers notifications@github.comwrote:

Worth a go - like I say I haven't seen this error before.

I've had a look on the Signar issues list but can't see anything there except something about having .net4.5 installed?

Have you tried creating a signalr application from scratch following the instructions at https://github.com/SignalR/SignalR/wiki/QuickStart-Hubs It takes about 10 mins. This was the simplist signalr application I could find and the one I used to create the example application.

The only line you will need to change is

to

The current version I think is 0.5.3 but you you can check the file name of the downloaded signalr javascript file.

There is a signalr forum at http://jabbr.net/#/rooms/signalr where the guy who wrote it can help you with the signalr specific queries but he'll just ask you to create an app following the wiki.

— Reply to this email directly or view it on GitHubhttps://github.com/mdevilliers/SignalR.RabbitMq/issues/1#issuecomment-8745531.

wizaerd commented 12 years ago

Please disregard my earlier email. Oddly enough, updating to SignalR 5.3 did resolve it. I coulda swore I had done that earlier this morning, but I guess I didn't.

Sorry for bothering you.

On Fri, Sep 21, 2012 at 2:07 PM, Joe aka Wizaerd wizaerd@gmail.com wrote:

I was eventually able to get a working SignalR app, but I am still unable to get the SignalR.RabbitMQ example to work, and it appears to stem around the "~/signalr/hubs" entry in the _Layout.cshtml. When I search around, the two different solutions (and only solutions) as far as I can see is to use @Url.Content("~/signalr/hubs") which I am using, and ensuring that the runAllManagedModulesForAllRequests is set to true in the web.config, which it is. Is there anything else you can think of that I can try?

On Thu, Sep 20, 2012 at 3:26 PM, Joe aka Wizaerd wizaerd@gmail.comwrote:

Unfortunately, I am unable to do anything with SignalR. I downloaded the source, loaded it up and tried to build it, which fails on

Error 215 Could not copy the file "....\SignalR.Client.JS\bin\jquery.signalR.js" because it was not found. C:\Users\jsheble\Documents\Visual Studio 2012\Projects\SignalR - Actual\samples\SignalR.Hosting.AspNet.Samples\SignalR.Hosting.AspNet.Samples.csproj 280 5 SignalR.Hosting.AspNet.Samples Error 220 Could not copy the file "....\SignalR.Client.JS\bin\jquery.signalR.js" because it was not found. C:\Users\jsheble\Documents\Visual Studio 2012\Projects\SignalR - Actual\samples\SignalR.Hosting.Owin.Samples\SignalR.Hosting.Owin.Samples.csproj 236 5 SignalR.Hosting.Owin.Samples

Which is entirely accurate because there does not appear to be that specific file in the directory it's expected to copy from. This of course was after I initially attempted the QuickStart you linked me to, since I already had the DLLs. BTW, it's got to be the worst QuickStart ever since it assumes you've used SignalR before, because there's a whole lotta stuff left out of that "QuickStart".

I am not new to this, I've been a professional developer for well over 27 years, specifically with .NET since 1.1 came out, and yet this is eluding me.

On Thu, Sep 20, 2012 at 2:04 PM, mdevilliers notifications@github.comwrote:

Worth a go - like I say I haven't seen this error before.

I've had a look on the Signar issues list but can't see anything there except something about having .net4.5 installed?

Have you tried creating a signalr application from scratch following the instructions at https://github.com/SignalR/SignalR/wiki/QuickStart-Hubs It takes about 10 mins. This was the simplist signalr application I could find and the one I used to create the example application.

The only line you will need to change is

to

The current version I think is 0.5.3 but you you can check the file name of the downloaded signalr javascript file.

There is a signalr forum at http://jabbr.net/#/rooms/signalr where the guy who wrote it can help you with the signalr specific queries but he'll just ask you to create an app following the wiki.

— Reply to this email directly or view it on GitHubhttps://github.com/mdevilliers/SignalR.RabbitMq/issues/1#issuecomment-8745531.

mdevilliers commented 12 years ago

Cool - just to confirm it all works ok?

If you have any other questions especially about your initial aim please feel free to contact me as like I said at my work we did something similar.

wizaerd commented 12 years ago

Yes it is working. I appreciate all your time and efforts in assisting me.

On Sat, Sep 22, 2012 at 10:11 AM, mdevilliers notifications@github.comwrote:

Cool - just to confirm it all works ok?

— Reply to this email directly or view it on GitHubhttps://github.com/mdevilliers/SignalR.RabbitMq/issues/1#issuecomment-8790759.

wizaerd commented 12 years ago

I hate to bother you, but I do have a question that perhaps you could answer.

Right now the SignalR.RabbitMQ example is self contained, meaning a browser initiates the "conversation" and the other browsers get whatever is sent by a single browser ala broadcasting. Is it possible to write a completely separate app, that writes to the SignalR exchange, and the browsers would then pick up those messages and display them as well?

Here's what I'm looking to build. We have a webapp that will submit a message to a RabbitMQ queue. A separate service picks up those messages and does some long running process, such as generating a report. I want the server to send progress information to the specific browser (the one that sent the request) as it's generating. So the webapp wouldn't necessarily submit the request to a service, but the service would need to be able to send status updates to the browser.

Is this feasible with your SignalR RabbitMQ implementation?

On Mon, Sep 24, 2012 at 7:32 AM, Joe aka Wizaerd wizaerd@gmail.com wrote:

Yes it is working. I appreciate all your time and efforts in assisting me.

On Sat, Sep 22, 2012 at 10:11 AM, mdevilliers notifications@github.comwrote:

Cool - just to confirm it all works ok?

— Reply to this email directly or view it on GitHubhttps://github.com/mdevilliers/SignalR.RabbitMq/issues/1#issuecomment-8790759.

mdevilliers commented 12 years ago

It is possible to write an app that writes to the signalr rabbitmq exchange directly.

The messages just need to be of a certain format - if you add another queue to the RabbitMQ exchange that collects a copy of all the messages you will see the format of the messages.

In the messages you will see that they require the connectionid of the browser connection so the other part of the puzzle is to keep a list of those connection ids (if you want to target a specific browser connection).

Be aware that this is unsupported and might break in future versions of signalr.

I am going to close this issue now but if you want to contact me directly I am at markdevilliers at gmail dot com if you want to discuss this further.