Rails API + AngularJS + Websocket-Rails gem

我与影子孤独终老i 提交于 2019-12-21 09:14:10

问题


My server is running the websocket-rails gem to handle websockets.

I'm having trouble using websocket-rails with a phonegap project that uses angular because I need to initialize the websocket-rails client in my Angular front end independent of the rails asset pipeline.

Is it possible to load the websocket-rails client separately into an angular project? Or can I use an angular socket directive to manange sockets with websocket-rails?


回答1:


I managed to get this working.

I translated all the coffeescripts into js with the coffescript CLI tool. Then I added those files to my project then called the methods in the controller per the websocket-rails docs.




回答2:


This guy has done the same translation. A github repo with the translated files. Hope it can help someone:

https://github.com/karimbutt/websocket-rails-for-js-frameworks



来源:https://stackoverflow.com/questions/23036101/rails-api-angularjs-websocket-rails-gem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!