B4J Question [ABMaterial] Chat Component : LoudThinking!

Cableguy

Expert
Licensed User
Longtime User
Hi Guys,

This will not be a "question" per sei but a few questions may arise from this...

I've been brainstorming ideas for my biggest endeavor so far in B4J and ABMaterial. Hoppefully it will become a management system for my boss, but thats beyond the scope of this post...

An idea came to me… I could integrate the CHAT component into my system, thus alowing live feedback… BUT...

1 - Being it an ABMaterial component, and that most potential targets will not be "live" on the app, would I need to also create, based on the same (EREL's) chat example, a "companion" mobile app for this functionality? Or maybe just somekind of notification to alert the target that a new conversation has started…?

2 - Being that, possibly, this Chat would/could be with more that 2 individuals… would this be even possible?

3 - (and maybe my biggest doubt) I'm Planning to use it within a ModalSheet, so that it could stay "dormant" while some other actions take place in the webapp, waiting for a new message to arrive...
Can it e done that way?

So I guess a few question have arised...

I'm not looking for code (although snippet are Always welcomed) but for guidance, on what would be the possible/best way to accomplish this, or even what to avoid doing...

Thanks guys!
 

Harris

Expert
Licensed User
Longtime User
I see where you are coming from, and I have the same issue, only slightly different.

I have a multi-tenant app - where many bosses need updates from many employees - that reside on a common DB (MySQL) server...
Your issue is easier - yet it should incorporate the same - since you never know where it will lead in the future...

Currently, I use a timer that fires every 60 seconds. ( I personally don't like this approach ).
Upon entering the page, code gets the number of messages for this comp_id. Each timer cycle will see if the number of records is greater than the base amount.
If a new message was posted, a Label, button, toast - will show new data has arrived - now press the Update Button to show new content.
We force the user to press Update, since they could have been doing something else - that we did not want to interrupt.


I want to use a MySQL trigger - or Stored Procedure, that would fire "something else" - to notify the app of new data - for the specific "boss" that needs to be notified.
This is where I fall down.

The timer works good - cause it knows how to ask the query for the company ID (comp_id - signed in user - who belongs to a company).
Yet, the Timer is not immediate. Trigger would be immediate - to fire some event... (to complete the notification)...

Just wait and see what our smart fellows here shall contribute to a well founded solution. For you, me and everyone that needs this...

@Cableguy , I like and support your approach in this post.
Ask the right questions based on your research of "what to ask"... You know what you don't understand - and what you do...
This helps everyone in a qualified response - without trying to ascertain what the heck you meant in the first place...

This is a classic example of how complex questions should be posed. Clear and concise - to your best ability...

Thanks
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
It is doable, but it ain't for the faint of heart :) Your server will have to keep track of messages and users and send it when the user opens the chatbox (a modalsheet cannot be hidden in the background, it is 'modal'). The Chat example in the zip is the best 'snippet' I can give you, and even so it only does a very basic chat.
 
Upvote 0

keirS

Well-Known Member
Licensed User
Longtime User
I see where you are coming from, and I have the same issue, only slightly different.
I want to use a MySQL trigger - or Stored Procedure, that would fire "something else" - to notify the app of new data - for the specific "boss" that needs to be notified.
This is where I fall down.

The timer works good - cause it knows how to ask the query for the company ID (comp_id - signed in user - who belongs to a company).
Yet, the Timer is not immediate. Trigger would be immediate - to fire some event... (to complete the notification)...

Just wait and see what our smart fellows here shall contribute to a well founded solution. For you, me and everyone that needs this...

Not ABMaterial but B4J. I played around with messaging based on insertion into a DB. I used the H2 DB and wrote a Java library that called methods from a B4J class. H2 triggers are written in Java so they can also be written in B4J. Use of H2 is fine for small number of users. I would quite happily use it for 1000 users but no so much for 100,000 users as it doesn't scale as well as MySQL.

Basically the trigger handed off the the construction and sending of the message to another B4J server as to not slow down the DB.


You can do the same thing on a massive scale using the Amazon Aurora and Amazon Simple Notification Service. Using a AWS lamda function in an Aurora trigger you can directly invoke the Simple Notification Service. Aurora can be configured to be MySQL compatible.






.
 
Upvote 0
Top