Orchard CMS 中的 SignalR 聊天模块
continue
I am building an instant chat module for the orchard project I am working on. I would like to use SignalR to power the chat, however I am running into difficulties with this:
<script src="@Url.Content("~/signalr/hubs")" type="text/javascript"></script>
I receive 404 error with everything I try. I have RAMFAR in webconfig, I have tried rewritting the url on IIS. I am hoping it is something horribly simple that my addled brain cant quite see. I don't even know for sure that SignalR works with Orchard, I suspected there would be some difficulties though
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
It's much more tricky than @mdm described... SignalR uses a custom HttpModule that handles hubs. Unfortunately, due to dynamic loading of module assemblies there is no way to wire that HttpModule from a module without altering Orchard core.
Fortunately, I managed to sort things out and made a live demo with Orchard and SignalR playing nice together! Making it work was quite tricky and involved dropping the HttpModule in favor of a custom route implementation. I'll push the module to Orchard Gallery after doing some necessary cleanup and post an update here.
UPDATE: Module is nearly finished. There was a lot of changes in SignalR library since I started so needed to incorporate those.另外,Orchard 核心(会话处理)有一个细微的变化,我需要在实际发布模块之前推送它。
更新 2: SignalR 现在使用 Owin,因此连接所有内容要容易得多。 Orchard 模块位于此处。您还可以从 BitBucket 获取最新代码。
顺便说一句,由于数据库事务处理发生了变化,我强烈建议使用 Orchard 1.x 分支中的代码进行 SignalR 开发。
It's much more tricky than @mdm described... SignalR uses a custom HttpModule that handles hubs. Unfortunately, due to dynamic loading of module assemblies there is no way to wire that HttpModule from a module without altering Orchard core.
Fortunately, I managed to sort things out and made a live demo with Orchard and SignalR playing nice together! Making it work was quite tricky and involved dropping the HttpModule in favor of a custom route implementation. I'll push the module to Orchard Gallery after doing some necessary cleanup and post an update here.
UPDATE: Module is nearly finished. There was a lot of changes in SignalR library since I started so needed to incorporate those. Also, there is one slight change to Orchard core (session handling) that I need to push before actually publishing the module.
UPDATE 2: SignalR uses Owin now so it's much easier to wire everything up. Orchard module is available here. You can also grab the latest code from BitBucket.
Btw, I highly recommend using code from Orchard 1.x branch for SignalR development due to database transaction handling changes.
continue
What is the URL that gets output on the page? What URL do you expect it to show?
Usually you would put the SignalR code in
Scripts/signalr
and reference scripts with the following at the top of your view:Or you could implement an
IResourceManifestProvider
in your module (Orchard.jQuery has a fantastic example of this, or see here), and then reference your scripts usingScript.Require
: