Giter Club home page Giter Club logo

feathersjs-wxmp-socket.io-client's Introduction

feathersjs-socketio-wxmp-client

lerna

  Feathersjs框架的微信小程序websocket客户端。

使用说明

 npm install @holytiny/wxmp-socket.io-client --save

  在client.js中

import feathers from '@feathersjs/feathers';
import auth from '@feathersjs/authentication-client';
import feathersSocketioClient from '@feathersjs/socketio-client';
import io from '@holytiny/wxmp-socket.io-client';

import Debug from 'debug';
if ('production'.localeCompare(process.env.NODE_ENV) !== 0) {
  Debug.enable('*');
}
const debug = Debug('@feathersjs/socketio-client');

export default function FeathersClient () {
  debug('create socketio client');
  const socketioInit = io('http://localhost:3030', {
    transports: ['websocket'],
    forceNew: true,
    timeout: false
  });

  const feathersClient = feathers();
//feathersClient.configure(feathersSocketioClient(socketioInit, { timeout: 1000 * 20 }));
  feathersClient.configure(feathersSocketioClient(socketioInit));
  feathersClient.configure(auth());

  return feathersClient;
}

  在xxx.js中

import FeathersClient from './client';
const feathersClient = FeathersClient();

  具体使用请参考Feathersjs的@feathersjs/socketio-client文档

@holytiny/wxmp-socket.io-client

  @holytiny/wxmp-socket.io-client是本项目的一个包,提供了Socket.IO-client在微信小程序环境下的兼容版本。 这个包可以单独使用,具体请看说明

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.