chat

How do I create a chat server that is not driven by polling?

南楼画角 提交于 2019-12-05 13:13:43
I have created a simple chat server that is driven by client polling. Clients send requests for data every few seconds, and get handed any new messages as well as information about whether their peer is still connected. Since the client is running on a mobile platform (iPhone), I've been looking for ways of getting rid of the polling, which quickly drains the battery. I've read that it's possible to keep an http connection open indefinitely, but haven't understood how to utilize this technique in practice. I'm also wondering whether such connections are stable enough to use in a mobile setting

Android: auto scrolling down the EditTextView for chat apps

这一生的挚爱 提交于 2019-12-05 13:11:25
Thank you for looking, I am creating a chat application. It works for the most part. The only thing I have a problem with is the scrolling. I use EditText to publish the new message from the server. by method msg = msg + "\n" + newMsg EditText.setText(msg) I need to make the new text that is under the old text visible as soon as it comes. So I think best way is to auto scroll down to the bottom as soon as the view is updated. Is there an easy way to do that? like in layout maybe? Thanks again! code for layout <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas

Using Google+ Hangouts API

我与影子孤独终老i 提交于 2019-12-05 12:54:19
问题 If someone adds bot@mydomain.com to his Google Hangout contacts and sends it a Google+ Hangout Chat message, I want to set up an automatic reply to his chat from my server. Is there a way to do that?? I think Its possible using the Google+ Hangouts API but I cannot figure out how. (mydomain.com uses Google Apps for Business) 回答1: Here's what you're looking: https://developers.google.com/+/hangouts/api/gapi.hangout.data Here's the event for message recieved: (callback) https://developers

How to show Blurred image before downloading(like in whatsapp) in ios?

一世执手 提交于 2019-12-05 11:20:41
I am making a Chat application for image sending and downloading. I want to do some animation like in WhatsApp. So, how to show the blurred image? My image is downloaded from server. Please help me. Scale the image down to a very small size like say 8x8 pixels. Send that data to the client. It should not be more than 4 * 8 * 8 = 256 B or 0.25 KB in size, so sending it to the client will not be a problem no matter how slow the client's connection speed is. Then scale the received 8x8 image to the resolution of the preview box (e.g. 256x256). You shouldn't need to upsample the 8x8 image if the

Telegram-based chat on a PHP-based site: HOWTO?

纵饮孤独 提交于 2019-12-05 09:19:01
I can't figure out what exactly to use for interaction between my site and the Telegram service (first of all - how to get the authentication process done using PHP and other stuff like chat among users). On this page: https://core.telegram.org/api I haven't got an idea how to use those functions in PHP. According to this page: https://telegram.org/apps I have two choices: 1) The CLI-interface (unofficial, by the way): https://github.com/vysheng/tg and it doesn't have an autentification function among others. In order to authenticate yourself, you need to run: bin/telegram-cli -k tg-server.pub

XMPP Multi user chat setting avatar image for the group chat

不打扰是莪最后的温柔 提交于 2019-12-05 08:53:36
I am developing an iOS application with chat features. I am using XMPP for that application. In XMPP Multi user chat, whether any feature is available to set avatar image or group image for the conference room like the one we do in whatsapp? I have checked XEP-0045 extension but it wasn't helpful, So I checked with Psi by creating conference rooms, I came to understand that the user has vcard so he can store his avatar image but the XMPP doesn't provide any vcards for the groups we create. Now I possibly understand why its not available. Yet I can't convince how whatsapp is able to achieve. I

Implementing a chat server as a WebService

烈酒焚心 提交于 2019-12-05 08:12:04
I have a school project in which I have to implement a chat application, whose server will be a java web service. The problem is that I've always thought of a web service as a way of calling remote functions, and I have no idea how to keep a "session" active on the web service, nor how to keep track of all the people currently in chat, rooms etc. To the best of my knowledge, a chat server is supposed to know its clients after an initial connection, and send every client message to all clients. This definitely calls for some sort of session maintenance. I think the right way to do this is as

Create a python server to send data to Android app using socket

主宰稳场 提交于 2019-12-05 05:29:22
问题 I am trying to create a simple chat server program using socket in python ( my pc ) to communicate with my Android client code ( my Android phone ) . I have a simple server code which receives messages but it blocks the client app and crashes when I try to send messages from server to client. The client code is based on this tutorial: Simple Android Chat Application, client side. Client code: private class ChatClientThread extends Thread { String name; String dstAddress; int dstPort; String

PHP Sockets is half-working

谁说我不能喝 提交于 2019-12-05 04:15:50
So, i have mIRC making a listen (bear with me on this one) on port 1235 and i tried to make a php script to connect to such port on my localhost server. My localhost is a clean Apache+PHP with mIRC being run on another computer (inside lan). The script works half-right as: 1) it connects to the 1235 port 2) it sends the $i 2.1) but on the other side no msg is recieved (aka I get a sock read event but no text pops up) 3) it reads all the incoming messages correclty 4) it closes when 'end' is the message drumroll 5) it only works IF the while function isn't present. 5.1) aka Inifi-loading. it

Dynamic UITextView mislocation behavior

此生再无相见时 提交于 2019-12-05 04:07:00
I am trying to have a textview similar to iPhone messages, where the textview initially has a constraint (height <= 100) and the scrollEnabled = false This is a link to the project: https://github.com/akawther/TextView The text view increases in height based on the content size as in the image on the left until it reaches the height of 100, then the scrollEnabled is set to true. It works perfectly until I click the "send" button on the lower right where the textView should become empty and go back to the original height and scrollEnabled becomes false. The middle image shows what happens when