Websocket's buffer nature?

Hello again! I have some doubts regarding the websocket buffer in autobahn. I would appreciate if someone could help me out!

In websocket once there is a new Message it looks like the buffer is cleared out:

def onMessageBegin(self, isBinary):
Implements :func:`autobahn.websocket.interfaces.IWebSocketChannel.onMessageBegin`
self.message_is_binary = isBinary
self.message_data = []
self.message_data_total_length = 0

Does that mean we can only send one Message through the connection and can’t send multiple (say from multiple different functions) messages through that same connection? (client to server)

If my question is not yet clear enough; does that mean we must wait for the message to be processed in the server before sending another one?

Through this logic I mean; we of course understand that the itself nature of websocket stands on processing one message at a time (right?) so if we send multiple messages over the wire they should be processed in order.
However, what if this message needs to be fragmented and it is sent fragmented over the wire, meaning, multiple fragments are sent BUT during this time, say due for asynchronous reasons, another internal function calls the sendMessage implementation function. In this case as I understand this will result in an overlap with the previous fragmented data and thus the fragmented message will be corrupted in the server, since the original buffer will be cleared out.

Or is it that by the nature of websocket a message that desires to be fragmented must be fragmented and sent immediately (in a synchronous fashion) over the wire? Thus, such corruption will never happen?

no, of course you can send multiple messages. it does mean that you cannot start to send fragments of a 2nd message before you have sent all fragments of the first. this is how websocket message fragmentation works (when no websocket extension is in place). I’d suggest reading RFC6455.

all of this stuff has complete test coverage via https://github.com/crossbario/autobahn-testsuite/

AutobahnPython passes this testsuite 100% (strict).

Awesome thanks for the feedback! I’m learning how to write clients and servers and feedback helps a lot! Also learning the crossbar framework to write good applications. I’ve one in github which combines react to produce a good degree chat application. Anyway if someone is interested: