Page 1 of 1

How to limit message length to 300 characters server-side in SmartFoxServer?

Posted: 10 Jun 2024, 14:41
by ciaoamigos
Hello everyone,

I'm working on a project with SmartFoxServer and I need to limit the length of messages that users can send to a maximum of 300 characters. I understand that the MaxMessageSize parameter refers to the message size in bytes rather than the number of characters.

- What is the correct way to check the message length server-side?
- Is there a better or more efficient way to implement this check?

Thank you in advance for any suggestions!

Best regards,

Re: How to limit message length to 300 characters server-side in SmartFoxServer?

Posted: 10 Jun 2024, 16:12
by Lapo
Hi,
limiting the size to 300 bytes for all messages would be problematic because there are standard API requests (such as SetUserVariable, CreateRoom, JoinRoom etc...) that might go beyond that limit and they would break.

What kind of request are you trying to limit exactly? Custom Extension requests? Other?

Thanks