RMI client using

Usage no npm install needed!

<script type="module">
  import socketIoRmiClient from '';


RMI Client (RPC Client)

npm version

The client side library for the RMI Server for making Remote Procedure Calls.

The RPC Client uses for communication over network.


As a common js module

The library could be used as a common js module as a node client or in a browser application through bundlers like webpack or browserify. The library is not bundled together so you will have to install the library as well.

$ npm install --save
$ npm install --save

UMD build through npmcdn

The UMD build of the library is available at npmcdn:

<script src=""></script>
<script src=""></script>


CommonJS module

The RMI Client could be used as a CommonJS modules when used in a node as a client or in browsers through webpack/browserify or in a ReactNative project.

'use strict';
import RMIClient from '';
import io from '';

// Connect to the RPC Server at the given address and port
// In case of browsers, the second argument could be empty
const client = RMIClient.connect(io, 'ws://server:port');
client.onConnected = function (remoteInstance) {
  // This callback is invoked as soon as a remote connection is established.
  // The RPC calls could now be carried on the remoteInstance
  remoteInstance.invoke().then((res) => {
    // The res is available after the remote invocation is completed.

  // make rpc call with callbacks
  remoteInstance.invokeWithCallback(function() {
    // this callback will be called from the server later.

  // get instances than can further make RPC calls
  remoteInstance.getAnotherInstance().then((anotherInstance) => {
    // anotherInstance can now be used to make RPC calls (if the method
    // actually returned a callable instance on the server)
    anotherInstance.invoke().then((res) => {


client.onDisconnected = function () {
  // If the client gets disconnected from the server, this method is invoked,
  // this could be taken as an opportunity to update the UI with the
  // disconnected state.

Using EventHandler

The RPC calls can also be used to pass EventHandler instances to the server. The server could raise events on this server as and when needed.

// Using Class for creating event handlers
'use strict';
const  RMIClient = require('');
const io = require('');

// The EventHandler class must be extended from RMIClient.EventHandler
class EventHandler extends RMIClient.EventHandler {
  // The event methods should be prefixed with 'on'
  onEvent() {


RMIClient.connect(io, 'ws://localhost').onConnected = function (instance) {
  instance.setEventHandler(new EventHandler());
// Using without declaring classes, most likely using UMD modules
RMIClient.connect(io, 'ws://localhost').onConnected = function (instance) {
  const eventHandler = RMIClient.createEventHandler();
  eventHandler.onEvent = function () {
    // This event will be raised from the server


More Documentation

For further more documentation and use cases, check out the RMI Server.