• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript socket.io-client函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中socket.io-client函数的典型用法代码示例。如果您正苦于以下问题:TypeScript io-client函数的具体用法?TypeScript io-client怎么用?TypeScript io-client使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了io-client函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: LoadEnvironment

$(() => {
  LoadEnvironment();
  RegisterBindingHandlers();
  RegisterComponents();
  InitializeSettings();
  if ($("#tracker").length) {
    let viewModel = new TrackerViewModel(io());
    ko.applyBindings(viewModel, document.body);
    viewModel.ImportEncounterIfAvailable();
    viewModel.GetWhatsNewIfAvailable();
  }
  if ($("#playerview").length) {
    let encounterId = env.EncounterId;
    const playerView = new ReactPlayerView(
      document.getElementById("playerview__container"),
      encounterId
    );
    playerView.LoadEncounterFromServer();
    playerView.ConnectToSocket(io());
  }
  if ($("#landing").length) {
    let launcherViewModel = new LauncherViewModel();
    ko.applyBindings(launcherViewModel, document.body);
  }
  $(".loading-splash").hide();
});
开发者ID:zipzav,项目名称:improved-initiative,代码行数:26,代码来源:Index.ts


示例2: socketioClient

  mounted: () => {
    const liveButton = document.getElementById('live-button');
    const socket = socketioClient(
        SOCKET, {reconnectionDelay: 300, reconnectionDelayMax: 300});
    socket.connect();

    socket.on('connect', () => {
      liveButton.style.display = 'block';
      liveButton.textContent = 'Test Live';
    });

    socket.on('accuracyPerClass', (accPerClass: AccuracyPerClass) => {
      plotAccuracyPerClass(accPerClass);
    });

    socket.on('disconnect', () => {
      liveButton.style.display = 'block';
      document.getElementById('waiting-msg').style.display = 'block';
      document.getElementById('table').style.display = 'none';
    });

    liveButton.onclick = () => {
      liveButton.textContent = 'Loading...';
      socket.emit('live_data', '' + true);
    };
  },
开发者ID:AIED-ECNU,项目名称:tfjs-examples,代码行数:26,代码来源:app.ts


示例3: _connectSocket

  private async _connectSocket(socketServerUrl: string) {
    // Connect to the server
    const socket = io(socketServerUrl);
    // Add the socket io listeners
    socket.on('list:changes', (data) => {
      console.log(JSON.stringify(data));
      this._getListChanges(data).then((changes: any) => {
        console.log(JSON.stringify(changes));
        if (changes != "") {
          let web = new Web(this.context.pageContext.web.absoluteUrl);
          // get a specific item by id
          web.lists.getById(changes[0].ListId).items.getById(changes[0].ItemId).get().then((item: any) => {
            console.log(item);
            this._lastQueryDate = moment();

            // Create the notification panel
            this._createNotification(item.Title, item.SPFxThumbnail.Url);

            // After x seconds the place holder is removed from the DOM
            let that = this;
            setTimeout(
              function () {
                // Delete the notification panel
                that._deleteNotification();
              }, 10000);
          });
        }
      });
    });
  }
开发者ID:AdrianDiaz81,项目名称:sp-dev-fx-extensions,代码行数:30,代码来源:WebhooksToastNotificationsApplicationCustomizer.ts


示例4: apiSaga

export function* apiSaga() {
  const { apiHost }: ApplicationState = yield select();
  yield fork(getComponents);
  yield fork(syncWorkspaceState);
  yield fork(createSocketIOSaga(io(apiHost)));
  yield fork(handlePingPong);
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:7,代码来源:api.ts


示例5: it

    it('Delete socket new Point', done => {
        var data = {
            firstName: 'Jose', lastName: LAST_NAME_TEST, email: '[email protected]',
            contactNumber: '23234234234', address: 'jose fito address',
            latitude: 28.4666304, longitude: -16.3213076, ip: '19.16.2.3'
        };

        let socket = io('http://localhost:3000');

        socket.on(EMIT_REMOVED_POINT, (point: any) => {
            assert.equal(point.firstName, 'Jose');
            socket.disconnect();
            done();
        });

        request.post(
            'http://localhost:3000/api/points',
            { form: data },
            (error: any, response: any, body: any) => {
                if (!error && response.statusCode == 200) {
                    var newPoint = JSON.parse(body);

                    request.del(`http://localhost:3000/api/points/${newPoint._id}`,
                        (error: any, response: any, body: any) => {
                            if (!error && response.statusCode == 200) {
                            } else {
                                done(`${response.statusCode} - ${error}\n ${body}`);
                            }
                        });
                } else {
                    done(error);
                }
            }
        );
    });
开发者ID:najor,项目名称:ng2-md-arcgis,代码行数:35,代码来源:serverSocketTest.ts


示例6: io

 this.store.select(state => state.data.authentication.jwtToken).take(1).subscribe((token: string) => {
     this.socket = io(BACKEND, {query: "jwttoken=" + token});
     this.socket.on("UPDATE_REDUX", action => {
         info("Realtime update coming in!");
         this.store.dispatch(action)
     });
 });
开发者ID:brechtbilliet,项目名称:winecellar,代码行数:7,代码来源:realtime.ts


示例7: beforeEach

        beforeEach(done => {
            appConfig = {
                name         : 'Test API Server',
                version      : '0.0.1',
                database     : database,
                authenticator: authenticator
            };

            app = createApp(appConfig);
            listener = new SocketListener();
            listenerConfig = {
                action : sinon.stub().returns(Promise.resolve(actionResult)),
                adapter: sinon.stub().returns(Promise.resolve(adapterResult))
            };
            listener.on('test', listenerConfig);
            app.register('/', listener);
            app.on('error', () => undefined);

            (app.webServer as any).listen(testPort);

            socketClient = io(`http://localhost:${testPort}`, {
                query: { authorization: `token ${authToken}` }
            });

            socketClient.on('connect', done);
            socketClient.on('error', done);
        });
开发者ID:herculesinc,项目名称:nova-server,代码行数:27,代码来源:SocketListener.spec.ts


示例8: done

            beforeEach(done => {
                app = createApp(appConfig);
                app.on('error', () => undefined);

                listener = new SocketListener();
                listenerConfig = {
                    action : sinon.stub().returns(Promise.resolve(actionResult)),
                    adapter: sinon.stub().returns(Promise.resolve(adapterResult))
                };
                listener.on('test', listenerConfig);
                app.register('/', listener);

                (app.webServer as any).listen(testPort);

                socketClient = io(`http://localhost:${testPort}`, {
                    query: { authorization: `token ${authToken}` }
                });

                socketClient.on('error', done);
                socketClient.on('connect', () => {
                    socketClient.emit('unknown', payload, err => {
                        if (!err) {
                            return done('Should return error');
                        }

                        socketError = err;
                        done();
                    });
                });
            });
开发者ID:herculesinc,项目名称:nova-server,代码行数:30,代码来源:SocketListener.spec.ts



注:本文中的socket.io-client函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript socket.io函数代码示例发布时间:2022-05-25
下一篇:
TypeScript soap.createClient函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap