0.2.4 • Published 6 years ago

overactiv v0.2.4

Weekly downloads
6
License
MIT
Repository
github
Last release
6 years ago

Overactiv

Hyperactiv over WebSocket + RPC

npm install overactiv

Plain WebSockets

const WebSocket = require('ws');
const overactiv = require('overactiv').server;
const wss = overactiv(new WebSocket.Server({ port: 8080 }));

const remoteObject = wss.host({ });

Express Server

const http = require('http');
const express = require('express');
const WebSocket = require('ws');
const overactiv = require('overactiv').server;
const app = express();
const server = http.createServer(app);
const wss = overactiv(new WebSocket.Server({ server }));

server.listen(8080);

Node WebSocket Client

const WebSocket = require('ws');
const overactiv = require('overactiv').client;
const remoteObject = overactiv(new WebSocket("ws://localhost:8080"));

remoteObject.someMethod();
remoteObject.value === "This has been set!";

Browser WebSocket Client

<html>
    <head>
        <script src="https://unpkg.com/hyperactiv" ></script>
        <script src="https://unpkg.com/hyperactiv/handlers/index.js" ></script>
        <script src="https://unpkg.com/overactiv/browser.js"></script>
    </head>
    <body onload="overactiv('ws://localhost:8080', window.remoteObject = { })">
        Check developer console for "remoteObject"
    </body>
</html>
0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago