Replies: 2 comments 3 replies
-
QUIC as WebTransport should be looked at as the networking standard bevy at least supports, if not prefers. |
Beta Was this translation helpful? Give feedback.
1 reply
-
In order to work at the browser level ( which is a very large space where bevy exists rn ) we need to either support webrtc or webtransport ( which is based on quic ). |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Goals
I propose a automated system for network io that is intended to make it easier for bevy uses to create apps that utalise the power networking for any application they desire. I am also inviting any criticism or suggestions, as I want this system to be the best it can. This main goals of this system are:
A system that meets the goals listed above could be a asset for networking in and of itself, however it could also serve as the basis for higher level networking abtractions in the future, such as a server-client replication system.
Design
The design is based on spin locks and global variables, with a emphasis on on ease of use and flexibility.
The idea is to have a type which buffers both incoming and outgoing data from and to the socket, with the actual interaction with the OS being handled by a par of system running each frame.
For eample adding a new socket might look like:
`let stream = TcpStream::new();
//the socket manager is a global variable that can
//be accessed from anywhere.
let manager = SocketManager::get();
//we pass in our TcpStream and get back access to an object which contains the
//incoming data obtained from the os, and any data we write to it
//will later to writen to the os in balk by the backend.
//This isolates any potential errors from the user and we only need
//pass back those errors for which there is no obvious cause of action
//and log the rest. This also means read/writing to this object
//does involve any async or blocking code,
//or any sys-calls.
let buffered = manager.register_tcp_stream(stream);`
In this design there would be a system that runs near the start of every frame that reads from the OS and populates the user-side
buffers with fresh data, and one near the end of each frame that writes data from the user side to the OS sockets. Data access are syncronised between the user and the backend by a spinlock.
Open Questions
What will be the allowed socket types?
I want the backend to be able to run asynchronously, but that means non-blocking async funtions that can read and write from TcpStream, and UdpSocket. async-net already provides async TcpStream, UdpSocket, and TcpListener types, which is quite conviniant, but they have to be constructed asynchronously and don't provide and method to convert their std equivalents into themselves. Which means the user has to use async code to interact with this system which isn't ideal, although there are work arounds such as allowing construction by directley passing parameters into the socket manager.
Beta Was this translation helpful? Give feedback.
All reactions