Fetching group/channel meta is closing the websocket

18 views
Skip to first unread message

Abdulhadi Bitar

unread,
Jul 23, 2024, 5:05:40 AMJul 23
to Tinode General
Hi all

We wanted to ask if someone would please help with something we are facing specifically on iOS.  We are getting a websocket close 1009 too big message when ~160 users are in a group/channel with a meta size of 5mb (each user's avatar is ~30kb).

For informational purposes this is what we are doing:

We have changed the registration process from:

  • uploading the avatar to the tinode server
  • getting the reference URL
  • created a thumbnail out of that
  • and register

To:

  • We stopped the image upload
  • We are not resizing the image
  • We are registering using only the base64 "photo data"

Because there was an issue as avatar uploaded before registration:
1- the avatar file will not have userid inside the db.
2- server will not be able to download the avatar using ref URL error message.

Gene

unread,
Jul 23, 2024, 5:59:50 AMJul 23
to Tinode General
Here is the configuration line which defines the maximum size of the websocket message (frame):

https://github.com/tinode/chat/blob/a97c49477fae478062238049e6cde2da2fe9c114/server/tinode.conf#L43
"max_message_size": 262144,

The websocket disconnects because your message size exceeds this limit.

I would generally suggest to read the documentation and comments in the config file.

Gene

unread,
Jul 23, 2024, 6:01:43 AMJul 23
to Tinode General
Also, generally we do not recommend huge read-write groups. I have never seen a use case which requires groups with 100s of read-write members. What people usually need is a group with a few writers and a lot of readers. That's what channel groups are for. 

Abdulhadi Bitar

unread,
Jul 23, 2024, 6:17:59 AMJul 23
to Tinode General
yes we have noticed this and kept default value as recommended 

On Tuesday, July 23, 2024 at 12:59:50 PM UTC+3 Gene wrote:

Abdulhadi Bitar

unread,
Jul 23, 2024, 6:24:33 AMJul 23
to Tinode General

we have only one writer all others are readers, but on iOS when sending {sub}  will get the error like this
{"sub":{"topic":"grpHJV32tXCKwU","id":"115747","get":{"desc":{"ims":"2024-07-21T10:25:02.522Z"},"data":{"since":6,"limit":24},"what":"desc sub data del"}}}' sid='GdvTtnQzNO0' uid='AYE2NQ_d1_g'
ws: readLoop GdvTtnQzNO0 websocket: close 1009 (message too big)

because {sub} will reply with {meta} contains all members info including the base64 photo data so {meta} size will be ~5MB

Gene

unread,
Jul 23, 2024, 10:27:26 AMJul 23
to Tinode General
You created a simple GROUP topic. My suggestion is to create a GROUP CHANNEL topic. There is a difference. Please read the documentation.

If you don't want to create a group channel topic, then don't ask for subscriber info, i.e. "what":"desc sub data del" -->> "what":"desc data del".
Reply all
Reply to author
Forward
0 new messages