giray
CCConvex Community
•Created by giray on 5/24/2024 in #support-community
Chat App Bandwidth Problem
Hi, I am building a chat based multiplayer game. As you might guess, there can be many players and chat is being used a lot in the game. To get the chat I use the below query:
The problem is that the game consumes a lot of bandwidth because of the chat and the problem is, a new action (new message or a reaction to any message) triggers a fetch, and I believe all clients who uses the above query, re-fetch the most recent 50 chat messages. Normally, I want to fetch all chat messages, I limited it to 50 because of this bandwidth problem.
I believe there should be a better way to fetch the chat messages for me. I have checked the paginated queries, however I could not figure out how to implement it for this problem. Mainly, I want to fetch all chat messages for a game, but I do not want it to re-fetch everything when a new message comes. (I believe Convex does not only send the changes but sends the result of the query as a whole). Convex caches the result of the query but the problem is not the cache, it is the bandwidth. I had to start a premium account even in the development stage and if I can not solve this problem, the game will not scale well.
For example, if I can paginate somehow and it seperates the whole chat into bundles of different queries than it will only consume bandwidth for small bundle changes. Any suggestions?
5 replies
CCConvex Community
•Created by giray on 5/5/2024 in #support-community
Is Client library acts like a store?
Hey, I have simple question. Does convex eliminates the need to use any global state libray? If I subscribe to the same exact query from different components, does it fetch multiple times or only once? Sorry the caching section in the docs, I guess, only relates to the backend caching.
3 replies
CCConvex Community
•Created by giray on 4/25/2024 in #support-community
Question about schema design for more frequently changing data
I could not find a definiteive answer in the docs. I would like to ask a schema design question. I am building a multipllier game which has 'games' table with all game information. However, in each game there is a counter that counts down and the game finishes when it reaches to zero. Currenty clients subscribe to the game and get all updates. Among all fields of the game, time is the one that changes frequently (every second). Is it better to separate it to another table with a relation and subscribe to it separately from the client in terms of performance and bandwidth considerations? Does the reactive query updates only send the "differences" compare to the last state or they send all data with each change?
3 replies
CCConvex Community
•Created by giray on 4/24/2024 in #support-community
Global Error Catcher
I have an application that has many mutations and these mutations return an error if the user is not logged in. In that case I want to direct user to the login page, however, I do not want to modify all my client code to do this for a particular error. Is there a way to catch all errors on the client side (NextJS app router)?
16 replies