Socket
Book a DemoInstallSign in
Socket

gopkg.in/go-flyrpc/flyrpc.v1

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gopkg.in/go-flyrpc/flyrpc.v1

v1.0.0-20150805102117-7e220f0b145f
Go
Version published
Created
Source

Build Status Coverage Status

FlyRPC is a PROTOCOL implements maximum features with minimal packet size.

go get gopkg.in/flyrpc.v1

What the protocol defined.

  • Asynchronous Request/Response
  • Request with unlimited string code and unlimited binary payload.
  • Response with unlimited string code and unlimited binary payload.
  • Compress code and payload
  • Request can have an implicit ack response or no response.

Protocol

Packet Spec

NameFlagSequenceCodeLengthPayload
Bytes12string\01,2,4,8*

Flag Spec

1234567 - 8
ResponseWait ResponseZip CodeZip Payloadlength bytes

API

// level 1
conn.onRawPacket(flag, seq, rawCode, rawPayload)
conn.sendRawPacket(flag, seq, rawCode, rawPayload)

// level 2
conn.onPacket(flag, seq, code, payload)
conn.sendPacket(flag, seq, code, payload)

// level 3
conn.sendRequest(code, payload)
conn.sendResponse(seq, code, payload)
conn.onRequest(function handler(seq, code, payload))
conn.onResponse(function handler(seq, code, payload))

// level 4
conn.send(code, payload)
conn.request(code, payload, function callback(err, code, payload))
conn.handle(code, function handler(payload, function reply(code, payload)))

conn.OnMessage(func(code, payload) (code, payload))

conn.Request(code, payload) (code, payload)

conn.Send(code, payload)

Draft

Network

  • [OK]TCP
  • UDP
  • Websocket
  • P2P

Serializer

  • Compress
  • [OK]json
  • [OK]protobuf (proto3)
  • [OK]msgpack

Multiplexing

  • Gateway Node
  • Backend Node

API

type MessageHandler

MessageHandler could take below params

  • *Context
  • *Packet
  • []byte
  • *UserCustomMessage

MessageHandler could return below results

  • UserCustomMessage, error
  • UserCustomMessage
  • error
  • no return

NewServer(*ServerOpts) *Server

Server.Listen(addr)

Server.OnMessage(path, MessageHandler)

Context.SendMessage(path, Message)

Context.Call(path, Message) (Message, error)

Context.Ping(length, timeout) error

NewClient(addr) *Client

Client.Connect(addr)

Client.OnMessage(path, MessageHandler)

Client.SendMessage(path, Message)

Client.Call(path, Message) (Message, error)

Client.Ping(length, timeout) error

Class Digrame

TCP/UDP/WS        Packet    json/protobuf/msgpack
 |                + + +                   |
 |                | | |                   |
 -->Protocol ------ | |      Serializer <--
      +       ------- |          +
      |       | ----Route --------
      |       | |     *+
      |       | |     |
      |       | |   Router
      |       | |    + +
      ------- | | ---- |
          1*| | + |    |
       --->Context     |
       |transport+*    |
       |        ------ |
       |             | |
 -->Client          Server<--   MultiplexedServer<--
 |                          |                      |
 |                          |                      |
TCP/UDP/WS            TCP/UDP/WS               TCP/UDP/WS
  • * Multiple instance
  • --> Extends
  • + Reference

FAQs

Package last updated on 05 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.