JustMaier / angular-signalr-hub

Handy AngularJS factory for SignalR Hubs
MIT License
291 stars 78 forks source link

Simplest Possible Example #32

Closed coommark closed 9 years ago

coommark commented 9 years ago

I am new to AngularJS and have been looking hard for a signalr wrapper. I downloaded this and tried severally to produce (without success) just a simple chat viz: a simple factory, and a controller that sends a message to the server-side hub, and a broadcast of that message to all connected clients. The sample I found using this wrapper is too complicated. Pls can someone provide a simple chat factory and a controller? Must I go the web api route to use this?

Like I keep asking myself "what's this lock and unlock anyway? Who wants to lock a chat?" This is so frustrating for those of use learning angularjs, who want to use mature libraries such as this. PLEASE!

DeBiese commented 9 years ago

I have created a simple chat example for you to explore.

This sample starts off with the MVC-SignalR chat sample that you can find here: http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr-and-mvc

What I ended up doing was making a quick and dirty angular app to replace the chat view from the mvc application.

I had to add some extra NuGet packages to the project. (check out the packages.config file) I added an app folder for the angular app, in which I added a module (signalRChatApp), factory (ChatService) and controller (ChatController). I also created the html page for the simple chat app itself. I modified the Global.asax.cs, BundleConfig.cs, RouteConfig.cs, HomeController.cs, Startup.cs, Index.cshtml

I think that's about it.

In the app folder for the angular app, I have a ChatService which uses the angular-signalr-hub. The hub in this case is the ChatHub in this project.

Download my full sample (with some overhead because I used the project for some other testing code as well) : http://1drv.ms/1K3EXpQ

coommark commented 9 years ago

Thank you so very much DeBlese! I am sorry I asked the way I did out of frustration. Thank you a million.

DeBiese commented 9 years ago

No problem. I hope it helped.

coommark commented 9 years ago

Hi DeBlese, just wanted to come back and thank you again for the sample. Just tried it and works like charm, and the coding style on the angular end is easy for a beginner like me. Thanks a million. Hope you'll drop it in the samples folder for others? And add a link at the project home for it? That will be great for other beginners. Awesome sample thanks once again!

mohamadnajiya commented 5 years ago

Hello,

Can you please reupload the example?

thank you for the module

JustMaier commented 5 years ago

@mohamadnajiya are you talking about this example? http://1drv.ms/1K3EXpQ

It looks like it's still there.