Socket, too many socket requests - node.js

Hi I don't understand why in my website the socket requests are multiple every time I send a message
using the browser console, on the network, the call comes out every time I send a message,
look at photos;
enter image description here
you can test the chat yourself, with every message you send the request appears on the network
Testing website
https://www.awesome-easley.37-187-54-25.plesk.page/
Can you tell me, if there is a way to not make the request list appear every time you send a message? do you have any suggestions?
using the site https://socket.io/demos/chat/, for example you send messages and no prompts appear using the console
enter image description here
why does the drop-down list appear on my site at each call and instead on the socket site no call is generated at each message sending? thank you
I thought it might be because of the cache, but I don't know where to start, does anyone have any suggestions?

Related

Pusher showing already sent data

I'm using pusher for a python-vuejs app.
I have a function that sends data to the pusher, the data content is {'message':{'value':id_value}}
The function is executed via an api rest POST request, when I trigger the function and send the data to the pusher on the page with the url host/data-url the pusher console shows the correct informations for the first time.
When I execute the POST request again (without refreshing the page), the data is gotten twice (gotten means that it is physically there not just a pusher console output), if i do the request again it is gotten 3 times and so on.
Does anyone have any idea on how to initialize pusher after each request or something because if I refresh the page and send the data, it works again and i get it only once.
I figured it out if anyone have the same problem.
1.You should subscribe the moment you call the page.
2.If you are triggering the channel.bind with a button click (or any event launcher ) , make sure to unbind before the click and not after.

Reset unread message count for Facebook page (Facebook Graph API)

I am trying to build a small Python tool to connect our Helpdesk software (Helpscout) with our companies Facebook page to be able to receive and answer messages from clients directly from within Helpscout.
I am using the conversation endpoint to grab all unread conversation:
conversations = api.get_object('[page_id]/conversations?fields=messages.limit(20){message,from},name, unread_count,message_count')
The problem is, once I read the messages the unread counter still stays the same until we open those messages directly from within the Facebook page. Spent lots of time to find a solution, but apparently there is no option to reset the counter or handle it any other way.
As a workaround I currently use the overall message count and compare it every time I check for new message to only load the new ones. That works fine, but there is still the issue that all messages stay unread on the Facebook page and will be all loaded again with every API call until we manually click them.
Thought about using Selenium to just do this job 1 time per day and clean the inbox, but don't really like this. Any idea how to solve this? Maybe I missed some API feature which can help?
I use the Send API to send the messages back to our customer, but could also not find any option to update the conversation in any way to handle it:
data = {"recipient": {"id": "xxxxx"}, "message": {"text": message}}
response = requests.post('https://graph.facebook.com/v3.2/me/messages?access_token=xxxx', headers=headers, data=json.dumps(data))
Maybe it is possible to move the conversation from the regular inbox to "Done" folder which could solve it?
After doing some research I found a solution to it here:
FbChatBot mark message as Read
You cannot update the unread count, but you can let all conversations automatically move to the "DONE" folder to let them not show up in your inbox anymore by using the "Handover Protocol": https://developers.facebook.com/docs/messenger-platform/handover-protocol
The app has to be set as 'Primary Receiver' and 'Page Inbox' as 'Secondary Receiver'.
All conversations will be moved to "DONE" now. Just make sure to set the correct permissions in the messenger webhook settings:
There will be no error without it, but messages will stay in the inbox and it does not work.

No user messages on Chatbase transcripts

I've been trying to take advantage of the Transcripts feature in Chatbase, but whenever I open a transcript all the user messages are shown as (No content).
The messages sent by the bot are all shown properly and the order of the messages is correct as well (both user and bot). On the messages report tab I can see the user messages so they are being sent across properly.
I'm sending all the messages using the generic message API, with the original text on the message field.
This has been happening consistently for me on all projects, so I'm probably doing something wrong..any ideas?
I work on Chatbase and would be happy to look into your issue. If you could please contact chatbase-support#google.com and provide the api key, the name of the bot, or the email address you used to create the account I will be happy to look into the issue for you.

Control your device with custom commands using Actions in Google

just getting started with Assistant features in RPi and I am able to successfully implement upto this point and wondering few thing.
Scenario:
user: hey google "please turn on my living room Lights"
List item my code in horword.py : has a function to perform same action based on ON_RECOGNIZING_SPEACH_FINISHED
RPi/google home: I am not sure how respond to that
I was able to capture the request query asked by user using ON_RECOGNIZING_SPEACH_FINISHED = Args.text(str) and use it in my logic to perform the task. However, at the same time, "ok google" is responding with this answer.
to mitigate this problem, I created an google-actions, now it understands my query and respond with intention from api.ai. However, didn't acts on turn lights ON. So, wondering how can I read response from google home/api.ai in text and change code to act on it locally.
appreciate it.
You will not get response as text.
For getting response to client app use webhook in API.AI and send message using fcm to client app.
Read the fcm message in client app and do the corresponding actions.
finally was able to figure out multiple ways. answered this in other stack question. find more details in this post.
Multiple ways to handle this since google doesn't gives voices transcript and we let google say our transcript which is kind off solution for now.

Firebase (Google) Cloud Messaging (FCM, old GCM) - check message status

I'm trying to find a solution to ensure a push notification to my Chrome extension has been received before sending another one. IF it hasn't been received and another one should go, I would change its content to tell the user he has multiple new informations to check.
So I'm looking for a way to check the previous message status using its ID, or check the queue of messages if using a collapse key, before sending a new one. But I can't find anything related to this, except here : https://support.google.com/googleplay/android-developer/answer/2663268?hl=en there is FCM message status detailed, but no way to get them after the first response.
I am aware receipts can be implemented using XMPP but I would really prefer to remain on the regular HTTP protocol.
Thanks ahead for any help.
XMPP receipts would be the recommended way for you to get an ack that the message was delivered. You can also use the Play Developer console (Android developer console) to view statistics on the status of messages. However this will not be sufficient if you want to automatically resend, you would have to do this manually.

Resources