1.1.0 • Published 5 years ago

fpm-plugin-socketio v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

fpm-plugin-socketio

the socketio plugin for fpm

Basic Info

  • Run Action Hook Name: BEFORE_SERVER_START
  • ExtendModule Name: socketio
  • Exception
    • E.SocketIO.CLIENT_OFFLINE
      			{
        errno: -10001, 
        code: 'CLIENT_OFFLINE', 
        message: 'The Client Id Not Online'
      }
      			```
  • getDependencies()
    • []
  • The Reference Of The Bind() Method An BizModule Object Contains 2 Functions
    • broadcast
    • send

Usage

  • Broadcast message

    fpm.execute('socketio.broadcast', message!Object) => Promise

    • It always return a resolved Promise { data: 1}
  • Send message to The client

    fpm.execute('socketio.send', message!Object) => Promise

    • message must contains a 'id' , otherwise it return a rejected promise
  • WARNNING The topic should be replace of the args.topic.

  • Subscribe Event To Receive Message

    • #socketio/connect
      			fpm.subscribe('#socketio/connect', (topic, data) => {
      				console.info(data.id)
      			})
      			```
    • #socketio/disconnect
      			fpm.subscribe('#socketio/disconnect', (topic, data) => {
      				console.info(data.id)
      			})
      			```
    • #socketio/message
      			fpm.subscribe('#socketio/message', (topic, data) => {
      				console.info(data.id, data.data)
      			})
      			```
1.1.0

5 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago