Giter Site home page Giter Site logo

ngbs's Introduction

NGBS - The ngmoco:) BertRPC Server

ngbs is a BertRPC server.

Features

  • OTP application and configuration
  • Builds with rebar
  • Module and function level ACLs
  • emfile overload protection
  • Runtime configurable Command dispatch instrumentation
  • Persistent and transient BertRPC connections
  • Safe bert decoding (binary_to_term(BertBin, [safe]))

Installation

Building ngbs

Prerequisites: - Erlang R14B+ - rebar

  1. rebar compile
  2. enjoy a well earned margarita

Configuring ngbs

In these examples we'll configure the ngbs server to listen on tcp port 8000 and allow clients to call any function in the my_api module as well as erlang:memory().

If you want to start the ngbs server via configuration only, add a section for ngbs to your erl -config <file>:

{ngbs, [{port, 8000},
        {allowed_calls, [{module, my_api},
                         {function, {erlang, memory, 0}}]},
        {listen_on_startup, true}]}

You can also start the ngbs server manually via the API.

In your application startup code, add code to allow calls to the API you want to expose to BertRPC clients:

-module(my_app).

start(_,_) ->
    %% applicaton:start(ngbs) has already been called by the
    %% time we get here.
    ngbs:allow_call({module, my_api}),
    ngbs:allow_call({function, {erlang, memory, 0}),
    ngbs:listen(8000).

Notes

Each BertRPC connection is run as a separate Erlang process. call requests are processed synchronously in these processes. Asynchronous cast requests are sent to a central cast dispatch process for background evaluation.

If the Erlang VM runs out of file descriptors (listen/accept returns emfile), the listener process will protect itself by catching the error and delay for 100ms before trying to accept again. The server will be unavailable to new connections during this time, but all established connections are unaffected.

Restrictions

  • ngbs at present can only listen on one port at a time.
  • The dispatch process that runs 'cast' calls
  • info packets are ignored.
  • Doesn't support BertRPC binary streaming

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.