【发布时间】:2021-07-05 17:50:34
【问题描述】:
我有一个 Angular 应用程序,它使用 @feathersjs/authentication-client 使用 socket.io 和 feathers-reactive 连接到 Feathers API。这很好用!
这是我的客户端代码:
import * as feathersRx from 'feathers-reactive';
import * as io from 'socket.io-client';
import feathers from '@feathersjs/feathers';
import feathersSocketIOClient from '@feathersjs/socketio-client';
export function fInit(options: FeathersOptions): void {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const _feathersAuthClient = require('@feathersjs/authentication-client').default;
const _feathersApp = feathers();
const _socket: SocketIOClient.Socket = io(options.feathersIP, {
transports: ['websocket'],
forceNew: true
});
_feathersApp.configure(feathersSocketIOClient(_socket))
.configure(_feathersAuthClient({
storage: options.storage
}))
.configure(feathersRx({
idField: '_id'
}));
}
在这种情况下,我只是启动了应用程序,而不是 API。 Feathers 被初始化并寻找没有找到它的服务器。
我想在 Angular 应用中了解服务器何时关闭?
每当发生此类错误时,我是否可以从上述代码中获得任何类型的事件、订阅、回调或其他任何内容?
非常感谢任何有关此问题的帮助/提示/指针!
提前致谢
*考虑到所有socketio、authentication-client 和feathers-reactive 的配置性质,我什至不知道错误来自哪里。
【问题讨论】:
标签: feathersjs