0.0.26 • Published 3 years ago

@m3o/m3o-node v0.0.26

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 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

3 years ago

0.0.26

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.20

3 years ago

0.0.14

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago