Open pmlopes opened 2 years ago
Hello, @pmlopes this looks interesting. I would love to be part of this conversation.
@pmlopes I have gone through this script. My overall understanding of this script is that it establishes a secure TCP communication between two parties to communicate with each other using TCP sockets. I also noticed it uses sockjs-client to implement this under the hood.
The event bus establishes a TCP socket communication between two parties, listens for messages, subscribes to particular channels to get messages, sends messages, and closes connections. The event bus can be configured with several parameters such as whether to reconnect if a connection closes, maximum reconnect attempts, whether to enable ping, etc. The event bus also can also change states based on which process is currently taking place (states can be CONNECTING, OPEN, CLOSING, and CLOSED).
Correct me if I am wrong 1-1 message flow is the process of sending a message to a particular address 1-N message flow sending a message to multiple addresses. 1-1 message reply: Replying to a message received with a reply address N-1 message (publish reply): Multiple handlers subscribed to a particular channel replying to a particular message using the reply address.
I will start working on refactoring the code and test it with the java server.
@pmlopes, I have also gone through the script. I have a question though, are we to open one or more pull requests concerning refactoring?
Hello @pmlopes . Am sharif and will be glad contributing to this project. am intrested in this issue , anyone working on it.
WebRTC eventbus extension to sockjs.
Vert.x already has some simple javascript library to handle all the sockjs event bus. You should attempt to understand the code living here:
https://github.com/vert-x3/vertx-eventbus-bridge-clients/blob/master/javascript/vertx-eventbus.js
Tasks
Get to know the code by refactoring
As you can see, this code is quite old and not using much of the features JavaScript offers today.
As a code exercise, you should start by refactoring the script to use:
class
to model theEventBus
object https://tc39.es/ecma262/#sec-class-definitionsPromise
to signal asynchronous return types instead of callbacks https://tc39.es/ecma262/#sec-promise-objectsThis would make you comfortable with the code.
Research the state of the art
A small research on state of the art is the follow-up task. This task is about learning WebRTC. Read the links:
Try to run the examples and see if you understand what is happening.
Research if there are already some project implementing this?
The third step is to use your favorite search engine and look up for projects already implementing the goals of this project.
You will probably find the following github repository:
If you pick it up from there you will notice that in a way the project is already there. But there's a catch. The code doesn't work with today's vert.x version.
Nevertheless, you will notice that the javascript script is highly based on our original code.
Start by drafting what are the differences and how we can port those to our script.
Backend coding
If you are working based on the knowledge from the previous example, you'll see that you will need some backend code too. Try to understand the code:
https://github.com/tommytee/vertx3-eventbus-webrtc-helper
Once you get the idea it means you will need to create a pull request to: https://github.com/vert-x3/vertx-web but this new handler should be written in java.
Investigate what is missing
The example is old, so it may mean that it doesn't implement signaling. Which means you may need to define a simple signaling support, however, remember that signaling can be easily done with the existing event bus support.
Close the open bits
Write a simple demo application where we can see this working.