chat

Comet VS Ajax polling

∥☆過路亽.° 提交于 2019-11-28 07:03:12
I need to create a chat like facebook chat. With Comet I need more memory to keep the connection. With Ajax polling there is a latency problem if I send request every 3-4 seconds. So... If the latency ( 3-4 seconds ) doesn't matter, Is Ajax Polling better for my case ? Latency is not the only problem. COMET (long-polling) "saves" your traffic - when you use polling, you cannot know, if there were changes on the server, so some of the calls may be just a waste of traffic and resources (e.g., even if no one's chatting, you're making calls every 3-4 seconds). In case of COMET, you generally need

Comet & PHP: How to use Comet with a PHP Chat System?

佐手、 提交于 2019-11-28 06:34:36
I have to build a simple chat system in PHP using Comet. I don't know what would be the best approach to this project. What is the best technique (cross-browser would be nice) to use, and how to implement it ? What libraries can I use that already have comet support. ( I don't want to use the Bayeux Protocol ) I already have a PHP backend running for the chat system, but I need some ideas for the interaction between client and server. Thank you all in advance. My regards. You may want to look at WebChat2 This project uses comet, AJAX, and a custom HTTP server to communicate with IRC via

How to know when user closes browser? Chat application

ⅰ亾dé卋堺 提交于 2019-11-28 06:09:07
问题 I have a simple chat client set up that allows users to login with a username and stores the messages they write in an sql database. Every 3 seconds, the database simply prints of all the rows. So it's basically a chat client. I'd like to keep a list of who's online. How can I do this? How can I sense when someone has closed the browser? Right now I'm pulling the username as $name = $_COOKIE["name"]; and if this value is empty, I know they left. But once they left, it's too late to know what

“User is typing” function in chat

人盡茶涼 提交于 2019-11-28 05:05:49
I'm trying to add in chat a "user is typing" function; chat written in PHP + MySQL/Ajax. How it should work: -when my chat partner X starts typing I see in my chat box: "X is typing" -when I (named Y) am typing he sees in his chat box: "Y is typing" (just like Yahoo Messenger). The code I've tried so far: <script type="text/javascript" language="javascript"> var timer = 0; function reduceTimer() { timer = timer - 1; isTyping(true); } function isTyping(val) { if (val == 'true') { document.getElementById('typing_on').innerHTML = "User is typing..."; } else { if (timer <= 0) { document

Best python XMPP / Jabber client library? [closed]

风流意气都作罢 提交于 2019-11-28 03:23:10
What are your experiences with Python Jabber / XMPP client libraries? What do you recommend? A. R. Diederich It depends what license you can use. Some popular libraries are GPL which can cause serious issues if you need to use it for work, especially if you need to keep proprietary extensions. The LGPL libraries are a little less popular, I think, but you have more flexibility with what you can use them for. I'd once looked at using twisted directly for some simple XMPP scripting but the documentation was literally non-existant. Like, I opened a published twisted reference manual and it didn't

Creating a private chat between a key using a node.js and socket.io

泪湿孤枕 提交于 2019-11-28 03:09:35
How do I emit a message to all users in a private chat sharing a conversation_id using node.js and socket.io? var express = require('express'), app = express(), server = require('http').createServer(app), io = require('socket.io').listen(server); conversations = {}; app.get('/', function(req, res) { res.sendfile('/'); }); io.sockets.on('connection', function (socket) { socket.on('send message', function (data) { var conversation_id = data.conversation_id; if (conversation_id in conversations) { console.log (conversation_id + ' is already in the conversations object'); // emit the message [data

Android Whatsapp/Chat Examples [closed]

懵懂的女人 提交于 2019-11-28 02:33:10
Does anybody have an example or a tutorial for a Android application like WhatsApp ? I want to understand how WhatsApp works and how it is programmed. I want to see an example that uses a message-chat-system with "online"-status and "read the message" -information. I used Google but I found nothing. Maybe someone has a tip. Thanks. If you are looking to create an instant messenger for Android, this code should get you started somewhere. Excerpt from the source : This is a simple IM application runs on Android, application makes http request to a server, implemented in php and mysql, to

How to add an inline image to the end of a string in a TextArea in JavaFX?

China☆狼群 提交于 2019-11-28 01:19:58
I am trying to add an emoji to my chat program when my client types :) I am trying to add this in the FXML controller. I have captured when the user types :) using the following code snippet : if(chat.contains(":)")) { ... } My chat is printed into a textarea named taChat taChat.appendText(chat + '\n'); Any help is appreciated! A better approach would be to use TextFlow instead of using TextArea. Advantages : Individual Text are treated as children to the TextFlow. They can be added and accessed individually. ImageView can be added directly to the TextFlow as a child. A simple chat window with

Retrieve ServerValue.Timestamp from Firebase in Android app, when data is sent

岁酱吖の 提交于 2019-11-28 01:16:25
问题 I would like to know how to use Firebase's ServerValue.TIMESTAMP method, when I want to create a timestamp at the Firebase server, and then retrieve it to the local client. In Firebase guides, only javascript has a more detailed description of this case, but I'm having a hard time figureing how to translate this in to my Android appliction. Thanks in advance! 回答1: Firebase.ServerValue.TIMESTAMP is set as a Map (containing {.sv: "timestamp"} ) which tells Firebase to populate that field with

Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes?

一笑奈何 提交于 2019-11-27 22:44:59
I am developing a news app but I am getting following errors in from gradle console (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:28.0.0) Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:28.0.0) Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:28.0.0) Duplicate class android.support.v4.graphics.drawable