myl*_*ord 7 node.js socket.io angularjs bower ionic-framework
这里有一个建议:https://github.com/btford/angular-socket-io/issues/127
确保你有socket.io客户端库:
bower install socket.io-client --save
Run Code Online (Sandbox Code Playgroud)这并没有解决我的同样错误的问题.
包括在index.html中:
script src="lib/angular-socket-io/socket.js"
Run Code Online (Sandbox Code Playgroud)在app.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services',
'starter.directives', 'btford.socket-io'])
Run Code Online (Sandbox Code Playgroud)在services.js
.factory('seatStatusSocket',function(socketFactory){
var myIoSocket = io.connect(porturl); // io is not defined here, suddenly.
Run Code Online (Sandbox Code Playgroud)之前它正在使用lib的远程副本.当这个错误开始时,我更改了index.html以链接本地副本,因为这个远程版本也收到了Bad Gateway错误(现在很好,但仍然没有定义socket io如上所述).
删除:
script src="http://chat.socket.io/socket.io/socket.io.js"
Run Code Online (Sandbox Code Playgroud)
版本
socket.io@1.3.7 node_modules/socket.io
node --version
v0.12.7
Run Code Online (Sandbox Code Playgroud)
Krz*_*pka 10
你必须包含在index.html中:
script src="<bowerComponentPath>/socket.io-client/socket.io.js"
Run Code Online (Sandbox Code Playgroud)
在这之前:
script src="<bowerComponentPath>/angular-socket-io/socket.js"
Run Code Online (Sandbox Code Playgroud)
这是必需的:
bower install socket.io-client --save
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7891 次 |
| 最近记录: |