Closed ferenczAndras closed 8 years ago
Hi, please excuse for delay. Before start I would like say thank you for using the chat :+1:
Yes, this is possible. I think the best way to do this is in single page app way, because you should avoid the refresh of the whole site when a user click on every single link, because the websocket traffic must connect to the server when the entire site is loaded.
The other way I can imagine to accomplish this and in a more easy way, is using the iframe html tag but I'm NOT recommend this option, use it just for testing or playing purpose not for something serious.
Hope this can help you. Bye
Thank you, for your answer! I managed to find a sloution, where the user is not deleted, from the server after disconnect, and The server waits a few seconds. If the user comes back, the user will not be deleted. I track for every user a "last active" variable, and using that variable, I know when i need to delete from the server the user. I am using nextTick() function to check in evry 10 seconds, if there's an user in plus. What do you say ?
Thanks :+1:
To me seems a very great and smart solution!! Please, if you can share to take a look would be great, as a gist on github or wherever you want. Thanks
I puted up the file. I know that u can ask me, what if the user is no more on the site, but the server shows that is online. And if somebody message to that user, what will happen with that message? I used Ajax, Post to a php file, where I sotre all the messages. This ajax is called ONLY WHEN SOMEBODY SENDS A MESSAGE. Storing data about the message, when the user comes back, I have the posibiltiy to check if there's new message for the user or not.
This is a very interesting way to solve this. But I think there is a simpler one: When a new message has arrived to a destination user who has left the chat but it still shown because of the "timeout reconnection" you could check if the socket to the destination user message is still connected, if no, you can feedback to the user who sent the message that the destination user is offline. :stuck_out_tongue_winking_eye:
Dear, Mr Lovelle, I still love this brilliant chat and i didin't find another better one! Congrats! I made a few changes and I found a few solution to improve the stabilty of the chat, I ll share the code with you when I get home. My question is about the main chat ( where the friend list is stored ) I would like to implement in to my site like facebook did, to be part of the site. Is that possible if i copy and paste the html layout? Do i need to change something else too ? Thankyou.
Hi, you are very nice, I'm really glad that you like the chat :smiley:
If you like to append the users chat to other part of the "chat html" without so much code refactor you could handle this in function main_chat_user_new at line 962, that is the main funcion when a user is new connected. For disconnection you have the "main_chat_user_offline_new" and when a user change his status you also have "main_chat_user_status" function.
I'm sorry, now some functions names seems to me very ugly and the code is not much explained as it should be.
Hope this helps you. Thanks and have a nice day.
solved
My question is: What do I need to change, or do in order not to disconnect and re connect to the chat every single time when a different page is loaded on the website. For example if I am using the chat while I am on the "Dashboard" and i want to go to another page, the chat is disconnecting and re conecting when the new page is loaded. I would like to avoid this, only Is this possible somehow? Thank you for the answer.