我有一个feathersjs服务器正在运行,我可以从浏览器客户端(使用webpack)成功连接到该服务器。现在我正尝试从运行在Raspberry Pi3上的nodejs应用程序连接到同一台服务器。当我查找时,我看不到服务器的活动。我为该服务创建了一个钩子记录器,并且它什么都不记录。我只能假设客户端从不连接。该服务没有验证钩子,因为我只是在开发中,所以不需要验证模块。Feathersjs节点套接字客户端未连接
我可以从RPI ping服务器,如果我把服务器IP /端口插入到RPI上的浏览器中,我会得到我的“我是羽毛服务器使用客户端”页面,以便网络连接和IP设置服务器很好。
任何关于如何追踪发生的事情的帮助。没有任何连接日志(在客户端上),我不知道发生了什么。我得到的只是.catch的超时错误。
下面是我的客户端代码,来自工作浏览器客户端的客户端代码。
工作的浏览器客户端安装
import feathers from 'feathers'
import hooks from 'feathers-hooks'
import socketio from 'feathers-socketio'
import auth from 'feathers-authentication-client'
import io from 'socket.io-client'
// const socket = io('http://localhost:3030', {transports: ['websocket']})
// const socket = io('http://192.168.43.114:3030', {transports: ['websocket']})
const socket = io('http://192.168.0.51:3030', { transports: ['websocket'] })
const api = feathers()
.configure(hooks())
.configure(socketio(socket))
// .configure(AUTH({存储:window.localStorage}))
export default api
不工作的NodeJS客户端安装
const feathers = require('feathers/client');
const socketio = require('feathers-socketio/client');
const hooks = require('feathers-hooks');
// const errors = require('feathers-errors'); // An object with all of the custom error types.
// const auth = require('feathers-authentication-client');
const io = require('socket.io-client/dist/socket.io');
const socket = io('http://192.168.0.51:3030', { transports: ['websocket'] })
const feathersClient = feathers()
.configure(hooks())
.configure(socketio(socket))
//.configure(auth())
module.exports = feathersClient;
节点应用程序,它只是在我的服务上进行查找。
const api = require('./api')
const switches = api.service('switches')
switches.find({
paginate: false
})
.then((response) => {
console.log('loading all switch data', response.data)
})
.catch((err) => {
console.log('error loading switch data', err)
})
错误从.catch
error loading switch data Error: Timeout of 5000ms exceeded calling switches::find
at Timeout._onTimeout (/opt/lighting-dev/node_modules/feathers-socket-commons/lib/client.js:87:25)
at ontimeout (timers.js:469:11)
at tryOnTimeout (timers.js:304:5)
at Timer.listOnTimeout (timers.js:264:5)