0.0.26 • Published 4 years ago

@m3o/m3o-node v0.0.26

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 years ago

M3O Node Client

The node client for the M3O Platform

Usage

Installation:

npm install --save @m3o/m3o-node

Request

Make a standard http request

const m3o = require('@m3o/m3o-node');

new m3o.Client({ token: 'INSERT_YOUR_YOUR_M3O_TOKEN_HERE' })
  .call('helloworld', 'call', {"name": "John"})
  .then((response) => {
    console.log(response);
  });

The output will be:

{ message: 'Hello John' }

Streaming

Make a websocket streaming request

const client = require("@m3o/m3o-node")

new client.Client({ token: 'INSERT_YOUR_YOUR_M3O_TOKEN_HERE' })
  .stream("helloworld", "stream", {"name": "John", "messages": 10})
  .then(stream => {
	stream.recv(msg => {
		console.log("message received: ", msg)
	})
}).catch(e => {
	console.log(e)
})

setInterval(() => {}, 5000);

Above example will output:

message received:  { message: 'Hello John' }
message received:  { message: 'Hello John' }
message received:  { message: 'Hello John' }
message received:  { message: 'Hello John' }
message received:  { message: 'Hello John' }
message received:  { message: 'Hello John' }
message received:  { message: 'Hello John' }
message received:  { message: 'Hello John' }
message received:  { message: 'Hello John' }
message received:  { message: 'Hello John' }
0.0.25

4 years ago

0.0.26

4 years ago

0.0.21

4 years ago

0.0.22

4 years ago

0.0.23

4 years ago

0.0.24

4 years ago

0.0.20

4 years ago

0.0.14

4 years ago

0.0.15

4 years ago

0.0.16

4 years ago

0.0.17

4 years ago

0.0.18

4 years ago

0.0.19

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago