3.2.7 • Published 7 years ago

migme-ferry v3.2.7

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

Ferry

Ferry transports packets to and from fusion/fission

NPM Version Build Status Dependency Status Dev Dependency Status Code Quality Code Coverage

Usage

Installation

Install Node.js

Run npm install

Testing

Run npm test

Loading Ferry

import Ferry, {Packet, PacketType, FerryEvent} from 'migme-ferry'

// Initialize Ferry by passing in an access_token
const ferry = Ferry({access_token: 'JdFsdKSDf9sbhjasbdk187y19bhsdjahb123iuh'})
// Connect and wait for promise to resolve
ferry.connect().then(() => {
  // Ready to send your packets
})

Sending a packet

// Create a new packet
const packet = new Packet(PacketType.MESSAGE)
// Set the fields to be sent
packet.setFields({
  destination: 'someone',
  content: 'The answer is 42',
  chat_type: 1,
  message_type: 1,
  content_type: 1
})
// Send the packet
ferry.send(packet)

Shorter way:

// Create a new packet with fields
const packet = new Packet(PacketType.MESSAGE, {
  destination: 'someone',
  content: 'The answer is 42',
  chat_type: 1,
  message_type: 1,
  content_type: 1
})
// Send the packet
ferry.send(packet)

Listen for packet received

ferry.on(FerryEvent.PACKET_RECEIVED, packet => {
  // Packet was received
})
3.2.7

7 years ago

3.2.6

8 years ago

3.2.5

8 years ago

3.2.4

8 years ago

3.2.3

8 years ago

3.2.2

8 years ago

3.2.1

8 years ago

3.2.0

8 years ago

3.1.2

8 years ago

3.1.1

9 years ago

3.1.0

9 years ago

3.0.1

9 years ago

3.0.0

9 years ago

2.2.4

9 years ago

2.2.3

9 years ago

2.2.2

9 years ago

2.2.1

9 years ago

2.2.0

9 years ago

2.1.3

9 years ago

2.1.2

9 years ago

2.1.1

9 years ago

2.1.0

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.2.0

9 years ago