Closed Frefreak closed 7 years ago
This is currently not supported, but it should not be extremely hard to add. The client must first send the length of the message, so it could be discarded at that point already, without parsing the 5MB of data.
Thank you for your answer! Looking forward to this.
I'll share my thoughts and insights on this:
I'm in favor of doing the simplest thing that could work in this case, which is allowing people to set a maximum chunk and/or message size. If a message exceeds this limit, an exception is thrown and the connection is closed.
@lpeterse @Frefreak I've created #152 to add these. I still need to add some tests but unless there's significant objections I think that is the API I will go with.
I haven't got time to try it but the API looks good to me. Let's wait for some time before closing this issue. Thanks for you work!
update: just tested it manually and it seems to work as expected.
I don't know much about websockets. Sorry if this is a noob question. What if a client send a large chunk of data to the server? It seems currently the server would try to parse the message anyways. Is there a way to configure it so that messages are discarded as soon as what the server received has already exceeds a certain limits, say 5MB?