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:
v2.0.3 BETA 16th Dec 2020
OSSN >= v5.6
OssnMessages >= 5.4
OssnServices >= 6.4
Private Network >= 5.4
FREE key from https://developers.giphy.com
FREE Channels app-key from www.pusher.com
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.
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
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
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.
Version history can be found in this Google Doc
WebChat Version History
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?
also a praise to z men he does a lot with ossn and always helps
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
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.
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
Hi Andre, thanks for the feedback. Are you saying long delays too?
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
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?
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');
}
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.