WebChat 2.0.3 BETA Download 2.0.3b

5.0
gb Kevin B 3 years ago

screenshot

This component adds a mobile-first, individually styled web chat module to OSSN. You need the Pusher Channels service for realtime updates.

You'll want to add the link to the main menu AND/OR redirect logins directly to WebChat using the Component Admin page:
Enable menu link and redirect

Latest Update

v2.0.3 BETA 16th Dec 2020

  • Feature request: Do not clear the message input field when you send a GIPHY
  • Changed component to store settings in the "site settings" rather than "component settings". Once set, these details will no longer need be input after ever install/upgrade.
  • Fixed incorrect case in ID name of ossn_com.xml
  • Moved "Web Chat" link to the "Links" section for better compatibility with OSSN standard installation.

Pre-Requisites:

OSSN >= v5.6
OssnMessages >= 5.4
OssnServices >= 6.4
Private Network >= 5.4

API Keys

GIPHY for animated GIFs that can be added to messages

FREE key from https://developers.giphy.com

Pusher - For the live chat feature

FREE Channels app-key from www.pusher.com

DEMO

https://kjbtech.co.uk/ossn
Demo site is running ossn 5.6, GreenByGreen theme and only has Private Network, API Services and WebChat components installed.

Near future updates

Add ossn credit
Message status dialog
Online status for group members
Block message content of blocked users
Hide blocked users from create new chat dialog
User is typing...
MP4 video uploads
Limits on number of images/videos people can upload
Allow to share images directly from profile
Add type to message table GIPHY, info, photo, profile image etc.
Implement OSSN blocked users
Migrate chat_api to ossn actions
Implement mobile notifications

TIDYING UP

Decide on consistent naming convention throughout. Is it Groups / Chats / WebChat etc. Need to keep language consistent throughout.
Remove ALL error_log / console.log and debug responses
Finish tidying up code and commenting (if I have time to kill)
CSS animations / transitions to make the experience feel more app-like.
Sounds for sending/receiving messages
White border on giphy thumbnail selection
change giphy default search as it keeps failing

NICE TO HAVES:

Encryption and Presence / Private Pusher Channels
Public/Private groups (to plan)
Voice and Video calls
Public Webcam broadcasts / channels
User Search by distance/gender etc
Who looked at me?
View and manage profile / galleries
View and post to walls

I'd be grateful for feedback on how I could improve the component. Any bugs or issues please also report here.

Older updates

Version history can be found in this Google Doc
WebChat Version History

Comments
German Michael Zülsdorff Replied 3 years ago

And that makes sense, Andre.
Because: How would you want to chat without identifying yourself, first? :)
Thus to fix that,
move line #30 in the com file if(ossn_isLoggedin()) { above the two page registrations (line #27)

German Andre kutzner Replied 3 years ago

Hy first of all praise a great idea I think I have tried it now but when I log out and want to go there directly, the error comes on the picture
enter image description here

gb Kevin B Replied 3 years ago

Thanks ~Z~Man. I've added array verification to prevent those errors now.

Currently it only updates their status when the contact list is updated on new notifications - so i'll add an explicit status check and update at some point.

Theres also now a home button to make it easier to return to the main site.

German Michael Zülsdorff Replied 3 years ago

Fine, with 1.3.1 friends are selectable now ...
enter image description here

But Honey's still producing those 2 warnings
this time in line 113 and 191
and after Botox sent her first message to Honey I got

"Invalid argument supplied for foreach()" in file /var/www/html/components/WebChat/plugins/default/webchat/chat_api.php (line 88)

Well, it doesn't really harm here, but it's no bad idea in general to check returns for something meaningful BEFORE further processing. :)

And: the online state doesn't refresh: Botox logged off, but is still green in Honey's list.

German Michael Zülsdorff Replied 3 years ago

enter image description here

As I said:
Honey and Botox are friends, but Honey never exchanged a message with anyone
Thus, when Honey opens the webchat

$recentMessages = CallAPI ($recentURL , $recentPARAM); is false

you're checking that correctly on #60
but not before the foreach loop
$listMessages is undefined because of the check in #60
so we're getting that second error

gb Kevin B Replied 3 years ago

Cool thanks for doing that. I get an average of 1s for my chat_api queries on chrome and Edge (Win10). So such a difference is baffling? What hardware are you running on?

I have a Lenovo ThinkCentre Pentium G2030 3.00GHz with 8GB RAM, which is not a particularly fast PC?

Can you tell me how to reproduce the error you received? It sounds like its trying to display messages for a contact where there are none... but I don't know how you got it to attempt to load data for a user not in the contacts list?

I'm currently just populating the contacts using the "recent_messages" API call. So if there are no existing messages, they wont appear. I will grab the friend list and any that dont have a message thread - will appear in the list still... and you'll be able to message them - I'll do that once the basic function works well :)

German Michael Zülsdorff Replied 3 years ago

So here are some results:
enter image description here
As you can see the avarage notif takes something between 6 and 7 secs
(the blue one is a send, sends seem to take a little longer.)
So in the bad case
1. a send has just been issued
2. the next notif will fetch nothing because the send's return is still pending
3. another notif is necessary to fetch the message
thus the 15 seconds I reported (= two notifs plus a little screenwork) make sense

There's another issue I found:
A member who never exchanged messages with a friend before is unable to use Webchat (both friends don't see each other) and my log gives

"Invalid argument supplied for foreach()" in file /var/www/html/components/WebChat/plugins/default/webchat/webchat_page.php (line 110)

"Invalid argument supplied for foreach()" in file /var/www/html/components/WebChat/plugins/default/webchat/webchat_page.php (line 171)
gb Kevin B Replied 3 years ago

Wow?! I was seeing about 5 seconds and thought that was slow. I'll disable all logging and switch to input instead of post as they may both improve performance.

I'll also have a dive into the service worker component to see how it works and see if I can utilise it for notifications.

The data its pulling back is a tiny amount, and even refreshing the content is done in single divs. Surprised it's taking so long :(

May need to do some performance profiling to see where the delay is happening.

German Michael Zülsdorff Replied 3 years ago

Running 1.3:
Webschat messages are updated now - but with a delay of ~ 15 seconds!
OssnMessages is updating almost immediately

Without an absolute path like /var/www/html/... whatever ... your logs are written into wild

gb Kevin B Replied 3 years ago

Ok despite chat_api not outputting the correct data to the log file - it all seems to be working! I have incorporated the API extension so thats no longer required, and have changed the Site URL and API Key so they are not hard-coded.

Component

Developer: Kevin
License GPL v2
Type: Communication
Requires Ossn Version : 5.5
Latest Version: 2.0.3b
Last Updated 3 years ago
Repository Url View Repository

Versions