-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement connection to RCSSServer and enable real-time game visualization #17
Comments
I support the first way and I've check its origin data format. It's easy to be parsed and transformed to graphic frames. Another idea about Finally, it's a interseting project. Hope it be better. |
Hello @kawhicurry, thank you for being interested in the project! WebSoccerMonitor should be a substitution of a monitor like I agree with your views on running teams and rcssserver in seperate containers with I also think that the first way should be the implementation goal. That's great you already have an idea on how this could be done and it is easy to achieve. Please feel free to go further. Also, have you seen the discussions about introducing JSON as the monitor protocol in rcssserver? Supporting it should also be easy, so I think we could support both protocols. What do you think? |
@mtfbs I just checked that issue. JSON will make everything much easier! JS is really good at parse json. And I also notice Mr.Hidehisaakiyama just add supports for About the support of both protocols, Directly parse it with JS is one solution. It "seems" not difficult to do it. But I notice this project has using json as the default data formats. So a middleware that transform old formats to json could be a better solution. This is my solution. Transform the old protocol into json protocol and send it to browser, browser parse it and show it. I'm not good at JS but I know how to implementate the middleware. Before that, I shoule learn ideas about Streaming media. It must be helpful. How's it? |
Awesome! I agree it should be easy to implement once rcssserver natively supports JSON, and I agree that we can work on supporting the old protocol first until then. I like the idea of transforming the old format to json; the only reservation I have is that, if possible, it should be done in the browser, because in order to ensure reliability and better compatibility as a tool, I want to make WebSoccerMonitor a frontend-only software (in order words, I want to completely remove the backend and have everything done in the browser). In that sense, I'll be creating some issues related to the need of removing the current backend as soons as I can. Do you think you can implement the transformation of the old format into JSON inside the browser? Maybe something like the monitor itself having an internal function that directly parses the data with JS and outputs it in JSON format so the monitor can display it with graphics. I agree that learning ideas about streaming media could be helpful, maybe we can learn about other projects that do similar things. |
I made some attempt today and found a big problem. |
It is indeed a big problem, thank you for realizing this. I think one solution would be to implement a UDP <-> WebRTC bridge inside rcssserver as described in this answer using a library such as libdatachannel. In my understanding, this would allow for direct connectivity between rcssserver and WebSoccerMonitor. I have created an issue on rcssserver about this. |
We discussed on the 2D League discord server, and came to the conclusion that implementing the UDP <-> WebRTC bridge would be very difficult at the moment. The proposed solution for the short term is to build a proxy inside rcssserver. |
I've checked WebRTC when I made attempt yesterday and I've read the source code of ##!/usr/bin/python3
# client.py
import socket
udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
tcp.bind(('127.0.0.1', 7000))
tcp.listen(1)
tcp2, addr = tcp.accept()
buf = tcp2.recv(40960)
# print(buf.decode('utf-8'))
udp.sendto(buf, ('127.0.0.1', 6000))
while True:
buf2 = udp.recv(40960)
tcp2.send(buf2) #!/usr/bin/python3
# client.py
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('127.0.0.1', 7000))
# buf = input()
buf = '(dispinit version 5)'
msg = s.send(buf.encode('utf-8'))
while True:
print(s.recv(40960).decode('utf-8')) So I think the problem now is "where should we put the proxy?" I won't forget WebSoccerMonitor is going to be a pure front-end program.So the proxy should be built into |
I agree we should discuss this implementation further in the rcssserver's issue, and I think your proposed solution is a good idea. I also agree we can start parsing json with js now. I've created an issue for tackling this specific problem. |
A small demo here. https://github.com/kawhicurry/WebSoccerMonitor-plain |
I can think of 3 ways of doing this:
1 - Make the SoccerWebMonitor frontend able to get data directly from the RCSSServer as it runs on the same machine. (probably the best idea if possible)
2 - Provide the teams binary to the SoccerWebMonitor front-end. It sends it to the back-end and runs the teams and the RCSSServer on a docker image. Sends data in real time by websocket to the SoccerWebMonitor frontend and show it on the Monitor2D (even if not done at first, could be a nice feature on the long-term)
3 - Make a connection between the RCSSServer and the SoccerWebMonitor backend, and connect the backend to the frontend with a websocket.
The text was updated successfully, but these errors were encountered: