I’m writing a custom server-client network library with the transport package to use in my projects. When i’m sending data, the first byte is always an operation id. I have some ids that are related to events such us client connected to server=> receive assigned id, disconnected from server=> reason, and so on. Is there a way to make these custom events related to the popevent so i can eliminate the need of “internal operation id”.
And as a possible feature request, when calling driver.connect(endpoint), a connection internal id could become the same as the one from the other side, for exemple, a client connection id could become the same as the respective server connection id.
So, if I understand correctly, you would like to be able to specify extra data for Connect and Disconnect events? If that’s the case, then unfortunately that’s not possible currently. We have discussed adding this in the past, but since the requirements could vary greatly from user to user, we erred on the side of minimalism and letting people build this themselves.
If you are certain that say a Connect event will always be followed by a certain operation ID, then you could write a wrapper for PopEvent (could even be an extension method to NetworkDriver) that swallows the original Connect event, and then re-emits it when that certain operation ID is received, along with any additional data that the operation carries.
Regarding having the same connection IDs server-side and client-side, I understand how this could be useful, but that is not something that we are likely to offer as a feature. For performance reasons, our connection IDs are basically indices into internal data structures, which makes them hard to share across instances. It would also require us to break the protocol used to establish connections (old clients could not connect to new servers, and vice versa), which is not something we wish to do anymore at this point.