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
gb Kevin B Replied 3 years ago

I have changed it so that it doesn't register the webchat page unless you are logged on. You will now get a 404 error if you try to directly access the link without being logged on. (if you aren't logged on - who are you trying to chat with?)

If I wrap the same loggedin check around the chat_api registration - it doesn't register the page - logged in or not. This causes strange issues - so I left that registering without a loggedin check.

Personally I would think a chat component should never be anonymous - so i'm thinking it would make sense for Private Network to be a pre-requisite too. Open to community feedback on that.

@~Z~Man I tried removing the chat template page as you suggested (which I agree seems to make a lot of sense) but for some reason, it was breaking the JSON return.

Viewing the plugin must have worked, as I know the "CallAPI" function in chat_api.php was running. I was logging out parameters to see what was being parsed.

chat_api was being called using the action "messages", which is triggered on line 66.
line 73 then calls CallAPI()
CallAPI then calls the OSSN API.
OSSN API returns the JSON correctly (I output json_decode($result) above line 26 to a file)
Line 26 of CallAPI then returns json_decode($result) to line 73.
If I then output what returned on line 73 - it just contains "1" instead of the JSON.

As soon as I put back the template page it starts working properly again?

Any thoughts?

German Andre kutzner Replied 3 years ago

also a praise to z men he does a lot with ossn and always helps

German Andre kutzner Replied 3 years ago

but you are so far that everything fits so i don't find anything negative so far it works so far keep on doing so very well

gb Kevin B Replied 3 years ago

Yeah that may be a limitation of the recent messages API. I haven't tested with lots and lots of users and older content. Though it should still load the messages when you click a contact?

The updating of contact online status will come later when I add a check for it. Currently it only changes when the contact list is updated when you receive a message (from a user you aren't currently chatting with) or refresh the page.

German Andre kutzner Replied 3 years ago

yes it takes some time when a user logs in this can only be seen by a refresh of the page like gehn only 10 chats he does not fetch old

gb Kevin B Replied 3 years ago

Hi Andre, thanks for the feedback. Are you saying long delays too?

German Andre kutzner Replied 3 years ago

thanks z men that worked it just needed another query login at the moment comes the 404 page with me mobile is the part really super i really have to say great so far it works so far i have tested it with a few users

gb Kevin B Replied 3 years ago

Ok that makes sense. I'm still learning the framework and how it works. So this is a great learning example thank you :)

It could improve performance if its not generating a page view too I would imagine?

German Michael Zülsdorff Replied 3 years ago

Next:
I have no idea what this chat_api_template is good for?
To me the chat_api looks like pure AJAX and only the JSON is of interest.
So why not simply doing it like that:

function chat_api(){
        echo ossn_plugin_view('webchat/chat_api');
        // $content = ossn_plugin_view('webchat/chat_api');
        // $title = 'Chat_API';
        // echo ossn_view_page($title, $content, 'chat_api_template');    
}
gb Kevin B Replied 3 years ago

Ah... This is handled if you have Private Network enabled.

Well spotted Z, I'll have to make sure the registration only occurs whilst logged in, to avoid non private network sites from displaying an error. Maybe I'll add a manual redirect to /home as webchat is pointless without being logged 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