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
French Christian Gicquel Replied 3 years ago

Hi Kevin, I have the file in French language: ossn.fr.php
If you're interested, tell me where to send it to you

gb Kevin B Replied 3 years ago

I'm happy to leave that where it is. It's not really doing any harm.

I have fixed the multi-line messages you requested, and added a send button in the process :) Added a nice feature where the input box grows as you type - and keeps the icons locked in place next to where you are typing.

enter image description here

And I have mostly sorted out the issue with the encoding. OSSN Message can see all characters correctly now.... but for some reason i'm inserting Unix style new line characters "\n" in place of the CRLF.

If you look at the below image, you can see how it displays side-by-side. WebChat displays it fine, by OSSNMessage doesn't like the characters. If you look bellow the screenshots, I have included a snippet of the ossn_messages table showing how the data appears in the table. Its near identical - but has \n in place of CRLFs.

enter image description here

I have spent literally 5 hours (18:07 - 23:34) tonight trying to figure this out. I tried all sorts of combinations of nlbr, mbconvertencoding, regex replacements and all sorts... I just can't lose those \n's !!!

I have also resorted to dumping my call to the API, and instead replaced it with a call to OSSNMessage - so it's now using OSSN Message to post the message, instead of the API.

Watching the response from ossn_plugin_view('messages/templates/message-send'... from both WebChat and OSSNMessage, I can see the \n coming back in response to the WebChat request, and </br> coming back in response to the OSSNMessage request. :( Is it perhaps because my main page is sending the message via curl to chat_api.php first? and that process is changing the format?

I am pulling my hair out here - so any pointers or suggestions would be greatly appreciated! :D

gb Kevin B Replied 3 years ago

When it fails, the session has already been established and we are inside the logged-in loop.

Also, everything else in the loop after the hook runs fine. So at the point that it executes the addHook, it's already checked the session status successfully otherwise it would be running the else clause instead?

German Michael Zülsdorff Replied 3 years ago

Yes, and that starts to make sense if you have a look into ossn.lib.users:
The logged-in/logged-off state is retrieved from the SESSION!
And since you're calling curl without extra SESSION specific options, it simply doesn't pass the existing session to Ossn, so ossn_isLoggedin() returns false here and your add_hook isn't reached at all.

But we don't need to worry about placing the hook outside, because all api calls are secured by the api key anyway. Aside from that: The idea of the api originally WAS MEANT to work by being called externally. And these 3rd party calls of course can't rely on whether there's an existing Ossn session or not, they simply have work anytime.

gb Kevin B Replied 3 years ago

enter image description here

Ok, so tried that and it clearly shows that the addhook fails to register the API extension if it is performed inside the "ossnisLoggedIn() loop.

:(

gb Kevin B Replied 3 years ago

Ok I'll give that a try. I'd put the hook inside the logged_in previously.

German Michael Zülsdorff Replied 3 years ago

Re

Fixed notifications and new messages that were not arriving. Custom Web API Extension was failing to register

Try to comment out that extra

ossn_register_callback('ossn', 'init', 'unread_messages_count_api');

and move that add_hook from line #27 before (outside of) if(ossn_isLoggedin()) {

gb Kevin B Replied 3 years ago

This is great feedback, thanks again :)

Ok, so currently I'm using the enter to submit, so you'll not get a new line. I'll have to put a submit button back on the screen and ignore the enter key to allow new lines. That's a quick easy one :)

I'll have to dig a little further into the special characters. Its probably the way I'm submitting them to the API. I may consider stripping out the API call and use an ossn function directly instead.

German Michael Zülsdorff Replied 3 years ago

Running 1.3.6 now I'm still getting encoding issues:
Emojis are working fine now, but apostrophes still not.
a compatible newline support support should be implemented, too
enter image description here

gb Kevin B Replied 3 years ago

Hi John,
There was a couple of rogue characters in the manifest :*)
I've generated a new one, along with a selection of icons, and it should now work much better. You'll have to clear all the cache from your phone before trying again though, as the manifest seems to get cached locally otherwise.

Let me know how you get on.

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