角插座-IO IO是没有定义插座、定义、IO

由网友(闹够了就来我怀里i)分享简介:有人建议在这里: https://github.com/btford/角插座-IO /问题/ 127 请确保您有socket.io客户端库: 凉亭安装socket.io客户端--save 这并没有与此相同的错误解决我的问题。 包括的index.html: SCRIPT SRC =LIB /角座-IO / soc...

有人建议在这里: https://github.com/btford/角插座-IO /问题/ 127

请确保您有socket.io客户端库:

 凉亭安装socket.io客户端--save 

关于HD audio前置io插座的问题

这并没有与此相同的错误解决我的问题。

包括的index.html:

  SCRIPT SRC =LIB /角座-IO / socket.js 

在app.js

  angular.module('启动',['离子','starter.controllers','starter.services', 'starter.directives','btford.socket-io的']) 

在services.js

  .factory('seatStatusSocket',函数(的SocketFactory){   VAR myIoSocket = io.connect(porturl); // IO是这里没有定义,豁然开朗。 

据前使用的lib的远程副本的工作。当这个错误开始,我改变了的index.html链接本地副本,因为这远程版本也收到了错误网关错误(现在的罚款,但仍插座IO是不是如上述定义)。

删除:

  SCRIPT SRC =htt​​p://chat.socket.io/socket.io/socket.io.js 

版本

  socket.io@1.3.7 node_modules / socket.io节点--versionv0.12.7 

解决方案

您必须index.html中包括:

  SCRIPT SRC =< bowerComponentPath> /socket.io-client/socket.io.js 

在此之前:

  SCRIPT SRC =< bowerComponentPath> /angular-socket-io/socket.js 

和yest这是必需的:

 凉亭安装socket.io客户端--save 

There was a suggestion here: https://github.com/btford/angular-socket-io/issues/127

make sure you have socket.io client library:

bower install socket.io-client --save

This didn't fix my problem with this same error.

including in index.html:

script src="lib/angular-socket-io/socket.js"

in app.js

angular.module('starter', ['ionic', 'starter.controllers', 'starter.services',       
 'starter.directives', 'btford.socket-io'])

in services.js

.factory('seatStatusSocket',function(socketFactory){ 
   var myIoSocket = io.connect(porturl); // io is not defined here, suddenly.

It was working before, using a remote copy of the lib. When this error started, I changed index.html to link a local copy, as this remote version also received a Bad Gateway error (now fine, but still socket io is not defined as above).

removed:

script src="http://chat.socket.io/socket.io/socket.io.js"

versions

socket.io@1.3.7 node_modules/socket.io
node --version
v0.12.7

解决方案

You have to include in index.html:

script src="<bowerComponentPath>/socket.io-client/socket.io.js"

before this:

script src="<bowerComponentPath>/angular-socket-io/socket.js"

and yest this is required:

bower install socket.io-client --save

阅读全文

相关推荐

最新文章