I’ve had experience building a variety of live chats for client apps and I can tell you its definitely possible to build a good chat system in Bubble. It’s not going to be on par with Slack but definitely possible.
This has been my experience as well. It works, but is not optimum. I notice that on mobile 3G/4G connections the speed and responsiveness is a huge problem for end users, especially in a world where FB Messenger, Whatsapp and Slack are king and people have gotten used to the “instantaneous” nature of chat.
I will say that paginating your repeating groups (ie showing max 10-20 results at a time) will improve speed to a certain extent. I’d be interested in hearing what @peng.o has done to build a good chat system in Bubble. Maybe there’s something I’m missing that’s obvious?
PubNub looks like a great option with their JavaScript SDK, thank you for linking to it. I’ll post here if I get around to testing that out. Ideally this would be integrated as a plugin, seems doable.
Repeating groups don’t load from the bottom up.
– If you mean the latest messages are supposed be at the bottom, you can accomplish adjusting how you sort the messages and have it always scrolled to the bottom
do search for messages in thread is cumbersome and slow to load. Increasingly so as this database grows.
– I recommend you only load a certain # of messages at a time and implement a workflow to load more (like scrolling up)
no presence indicators
– You mean like being online? I haven’t built something specific for this but I’m sure this could be achievable
I have created a test plugin for pubnub ChatEngine. But there is one issue with bubble that prevents it from being practical.
It is the issue of not being able to modify a thing client-side.
Think about it this way, assuming you’r able to receive messages, how are you going to display them in bubble?
Repeating group is likely the way. But repeating group requires a data type. If you just make it a text it means you can only use the message. But you need things like sender, time message was sent etc.
One work around will be to create a datatype in your database say Message which has fields to the text message, sender, time, etc, and use it for the repeating group.
Now comes the main issue, in a plugin states can only return primitive types like text, date, number, etc. You state cannot return a thing like message.
This means you will have to return the individual fields of the messages as different values.
But bubble doesn’t allow setting individual fields of a thing on client-side. Meaning its hard to come up with a way of displaying the data without interacting with the database.
But if you were to interact with the database then it defeats the whole purpose of using something like pubnub.
tldr:
Bubble will have to support ability to return an object (thing) as a plugin value or ability to modify a thing on client-side to have a practical implementation of pubnub chatengine in bubble.
In short we are trying to get the same loading effect as the bubble forums. when the forums thread is long and you enter far down the repeating group, as you scroll up more entries load above.
So we are loading the last ten with vertical scrolling . If for example we use Zeroqodes detect scroll position we can trigger the Repeating group to load X entries more.
The problem is that the Repeating group scroll position is now at 0 and we can not scroll any further up to trigger the repeating group to load an additional X amount more.
OK just for anybody else out there struggling with this we have a work around. But its all a bit rough!!
Message Input:
Firstly, you’ll need to have the message input and it’s trigger in a floating group fixed to the bottom.
Message Thread
The repeating group with the messages will need to be set to full list, be the full width of the screen, with its top at the top and its bottom bordering the input floating group. You will need to set a custom state (“message count” as a number) and then use “-” to set how many messages from the last you want to load.
Set RG’s Messages datasource to search for your messages “from #” messages “count”.
Be sure to add a conditional to this repeating group so that this doesn’t trigger when there are not enough messages. eg.
Use scroll to rg’s last message off send trigger.
Use airdevs stretch to fit code for alternating colour texts
Loading more entries as you scroll up
Use zeroqodes scroll detector to trigger the following work flows to ensure it smoothly loads as you hit scroll position 0% and resets itself to 1% off.