remotepy

1.0.3 • Public • Published

remotepy_jsclient

Remote Py allows you to write python functions and run it on a server. It also provides you interfaces in multiple languages including JavaScript, CSharp and Python to call the remote python functions.

It is a RPC mechanism built on top of Web Sockets allowing you to communicate both ways.

####Requirements

Please make sure you have a remotepy server that you are connecting to.

####Installation instructions

npm install remotepy

####Sample JavaScript client

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Remotepy Test Page</title>

    <script type="module">
      import { RemotePyClient } from 'https://unpkg.com/remotepy@1.0.2/build/remotepy.minobs.js';
      const client = new RemotePyClient('ws://server:port');
      const remotepy = client.getServerAPI();

      window.onload = function() {
        client.connect();
      }

      client.onopen = function() {
        remotepy.add(2, 3, function(sum) {
            alert(sum);
        });
      }

      client.onclose = function() {
        divStatus.innerHTML = 'connection closed';
      }
    </script>
</head>
<body>
    <div id="divStatus"/>
</body>
</html>

Package Sidebar

Install

npm i remotepy

Weekly Downloads

9

Version

1.0.3

License

SEE LICENSE IN LICENSE

Unpacked Size

20.7 kB

Total Files

4

Last publish

Collaborators

  • tamboli