Home › Forums › Add-ons › Repeater Field › Is using ACF repeater to develop chat system good?
I was asked to create a chat system for a car rental website. The website will have huge traffic. So a lot of users going to log in and at the same time adding cars and renting.
The chat system will be interaction between a car vendor and a client. If things workout between them the client pays and gets car location phone number etc.
The site is already using ACF, so this got me thinking if its a good idea to make a chat system using repeater?
Basically starts of with
wp_insert_post($post_data); to create a new post then
add_row( $field_key, $value, $post_id ); to insert a new row every time one of them replies.
My question: Is this a good idea considering the site will have huge traffic with many users chatting at the same time? Is it ok if both users insert a row at the same time? Are there any pros cons I should be aware of?
You could def. do this with ACF & WP, but I would think you would be better to use a third party system that specializes in this. Something like Intercom would probably suite you better.
You could tap into the API https://www.intercom.com/api if you need to sync with your WP install.
I’m with @nathanaelphilip on this one. Rolling your own chat system is probably not the way I’d go. There are already plugins for integrating chat into WP, like this one https://wordpress.org/plugins/wp-live-chat-support/
As far as cons for using ACF repeater fields, or ACF at all…
ACF is a great plugin but it has it’s limitations. Performance of ACF on a high traffic site where you’d need to store thousands of messages in the meta table would likely (eventually) crash the entire thing. You have to remember that ACF uses WP core built in meta table and meta functions for data storage and retrieval and it is the core functionality of WP meta that actually creates the limitations of ACF. ACF is tool for creating admin pages that are easy to use.
Think about what you would need to do in WP if you didn’t have ACF just using update_post_meta() and get_post_meta(). Not to mention that every chat string would need to have it’s own “Post” with related information about who is allowed to access it. What would hundreds of thousands of posts do to WP?
There is also the problem you mentioned of two or more people trying to update the same information at exactly the same time. I’d assume that this would be rare, but if you tried to perform to updates to the database at the same time, to be honest, I don’t know what the results would be. You could either loose a message or end up with DB errors that crash one side of the conversation.
This site does not even use ACF for this forum. It uses BBPress with some modifications done using ACF.
@nathanaelphilip @hube2 Thanks guys for a wonderful answer. I spoke to representatives of this website you mentioned: https://www.intercom.com/ unfortunately they said they cant help out with what I need. Is there any other portal you guys can recommend?
Also I came across this plugin: https://wordpress.org/plugins/private-messages-for-wordpress/ it creates another table to handle messages. Is this a better option to have different table?
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.