DEV Community

Discussion on: Video Chatting and Screen Sharing with React, Node, WebRTC(peerjs)

Collapse
 
xandris profile image
Alexandra Parker

The Connection class is defined in connection.js, but it is not used in connection.js and it is not exported from connection.js. What part of the code uses it?

The Connection class is an ES6 class, but all its methods are assigned as instance fields. This is surprising when using a class because you would normally expect a class to have prototype methods. What I mean is I would normally expect to see this:

class Example {
  method() { body; }
}
Enter fullscreen mode Exit fullscreen mode

And instead you have this:

class Example {
  method = ()=>{ body; }
}
Enter fullscreen mode Exit fullscreen mode

Explaining why you are doing it this way would help the reader :)

Putting a language tag on your code fences would make it much easier to read!

'''javascript
Enter fullscreen mode Exit fullscreen mode

(I couldn't figure out how to escape code fences here on dev.to, so I used single quotes place of backticks.)

Collapse
 
arjhun777 profile image
Arjhun777 • Edited

connection class is used in step-7, by calling createSocketConnectionInstance() - also this just rough code with all functionalities to create video and screen sharing application

Collapse
 
deepaksai1919 profile image
Deepaksai1919

new SocketConnection(settings) is used in the code instead of new Connection(settings) in createSocketConnectionInstance()

Collapse
 
xandris profile image
Alexandra Parker

The code as written says this:

export function createSocketConnectionInstance(settings={}) {
    return socketInstance = new SocketConnection(settings);
}
Enter fullscreen mode Exit fullscreen mode

Should that be new Connection(settings) instead?

Thread Thread
 
arjhun777 profile image
Arjhun777

yes