Jump to content

https://peerjs.com/ - is this feasible?

Recommended Posts

Just wondering how feasible would it be to use https://peerjs.com

to connect two separate web sessions?


What I am trying to achieve is to have a tutor and student working on their browser but the two instances of the exercise are linked. So when student types something in the tutor side is updated to show what was typed. Likewise, if tutor clicks a button that action can be transferred to the student side.

If this appears feasible I would consider a commission or bounty to implement in an existing project depending on how much effort etc


Alternatively would it be possible to show the tutor side a simple screen capture of the student side? If so where would I find information on that option.




Link to post
Share on other sites
  • Moderators

Just going through the first bit of their docs, it looks fairly straightforward

procedure TForm1.W3Button1Click(Sender: TObject);
  var Script := browserapi.document.createElement('script');
  Script.src := 'https://cdn.jsdelivr.net/npm/peerjs@0.3.20/dist/peer.min.js';
  Script.onload := procedure
    writeln('peer.js loaded');

    asm @mypeer = new Peer({key: 'lwjd5qra8257b9'}); end;   //demo key

    mypeer.on('open', procedure(id:string) begin writeln('New peer ID : ' + id); end);


the remainder doesn't look too cumbersome, i'll have a look later

Link to post
Share on other sites
  • Moderators

just as a proof of concept :

tutor initiates conversation with student : https://lynkfs.com/Experiments/peer/receive/www

and on another machine https://lynkfs.com/Experiments/peer/send/www (must be on another machine)

student sends a text by copying tutor id into the edit box and pressing buttons 1, 2 and 3
this text then arrives at the tutors project

The user interface of these projects is really bad, sorry, just proof-of-concept. 

This demo is basically a simple chap app, but since it is using webrtc (and webrtc handles not only text but also other media), I feel that extending this to a full-fledged channel between parties should be feasible and reasonably straightforward


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...