EzDevInfo.com

chat

a live chat built with python(flask + gevent + apscheduler) + redis Limboy's HQ

Android Whatsapp/Chat Examples [closed]

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.


Source: (StackOverflow)

Best python XMPP / Jabber client library? [closed]

What are your experiences with Python Jabber / XMPP client libraries? What do you recommend?


Source: (StackOverflow)

Advertisements

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

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.


Source: (StackOverflow)

How does in-browser chat work?

Just curious. How exactly does chatting in a browser work? Usually if a user goes to a web page, his/her webbrowser requests the page content. A server produces output and sends it to the user's computer. But with chatting it's a little bit the other way around (well not exactly). It's not the user requesting a chat message from some server, but rather the server that sends it directly. Now this is really simple to achieve with a "normal" server, but the thing that the server sends it to a browser directly confuses me. The posting the message part is all clear, it's simple. You just post the data to the server with for example ajax or something. But how does the other computer instantly "know" that a message has been written to it? It must obviously be the server sending it to the other computer as soon as it has been written. But somehow that doesn't compute in my brain. In my brain, the browser only request things, it doesn't just get them. How exactly do you do that?

Take google talk in gmail for example. How does that work? How is it implemented?


Source: (StackOverflow)

Google chat server archive (XEP-0136)

I am looking for a way how to retrieve archive of chat messages from google server via using XEP-0136 standard, but I got these results just trying to ask for the feature.

Request:

<iq type="get"><pref xmlns="urn:xmpp:archive"/></iq>

Response:

<iq xmlns="jabber:client" type="error" to="myEmail@gmail.com/9FF72CA7">
    <pref xmlns="urn:xmpp:archive"/>
        <error code="501" type="cancel">
            <feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
        </error>
</iq>

So it looks like google does not implement this feature, but is it true? I don't think so.

The same happened with trying to set invisibility which is definitely supported by Google server.

Request:

<iq type="set" id="invisible1" from="myEmail@gmail.com/00230F07">
    <query xmlns="jabber:iq:privacy">
        <active name="invisible"/>
    </query>
</iq>

Response:

<iq xmlns="jabber:client" type="error" id="invisible1" to="myEmail@gmail.com/00230F07">
    <query xmlns="jabber:iq:privacy">
        <active name="invisible"/>
    </query>
    <error code="501" type="cancel">
        <feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
    </error>
</iq>

So probably I am doing something wrong. Any help will be appreciated.


Source: (StackOverflow)

iOS chat APNS, sockets or time interval [closed]

I'm making a chat app for iPhone, but im not sure how conversation messages should come instantly.

I have read tons of Google results on this topic. Also the once on:
- http://www.raywenderlich.com/3932/how-to-create-a-socket-based-iphone-app-and-server
- http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12

APNS approach:
An invisible notification will be pushed to the iPhone indicating that a new message is ready to be read. So the app will make a request for unread messages. So instead of manually polling new messages, I will let APNS help with that. But I'm not sure?

Sockets approach:
Making a socket connection that is open to share data. When new messages is found in db, it will automatic send the data to the app. But what about IP range, firewall, power consumption, other things? again I'm not sure :(

Polling approach:
Make a time interval where I poll request, power consumption is my enemy here.

My question:
- Which approach is best?
- Other suggestions?
- I really need some cons and pros from people with experience on this topic.

Examples is always good.
Thanks


Source: (StackOverflow)

Use HTTP Keep-Alive for server to communicate to client

Recently in an interview I was asked how I would approach an online chat client application. I went through the standard "polling" solution but was cut off because the interviewer was looking for the "HTTP 1.1 keep-alive" method. Having used HTTP for quite a while and remembering that the whole point was to be "stateless", this never occurred to me (also, not to mention that the keep-alive is not consistently implemented).

My question is, is it possible for a web server to broadcast and/or send information to a client when the "keep-alive" header has been set?


Source: (StackOverflow)

Best way to store chat messages in a database?

I'm building a chat app and I want a full history off all messages ever sent in the chat conversation. At the moment I am storing each message as a single row in a table called 'messages'. I am aware that this table could grow huge as even small messages like 'Hi' would have their own database record.

Can anyone recommend a more scalable mysql solution? I don't require the individual messages to be searchable, editable or deletable. Could the whole conversation be stored in one huge field?

Would love to hear your ideas!


Source: (StackOverflow)

Developing Chat API like that of Stackoverflow

How to begin developing chat api, like the one stackoverflow uses? If it is open source, where can i find it, if not can anyone guide me how to build a similar chat api?


Source: (StackOverflow)

Developing a Video Chat Application with high quality video streaming

I am working for a company where we are developing video chat support on an existing application. I have looked at various solutions for this like

  1. Using Managed Direct show for video capture and streaming in C#
  2. Some code samples in code project where we take an image and pass it over the network (I would call it rather a crude solution as this would eat up lot of bandwidth.
  3. Code a compression algorithm from scratch from scratch and use it to compress-decompress video.

Now the challenge is that we are looking to achieve very high quality video streaming and the container application is coded in C#.NET

This is what I have proposed so far. The network logic to stream data is written in C# , the video compression to be written in VC++ and call this VC++ dll using pinvoke or either CLI which way possible.

I am looking for some one more experienced that me in this field who can suggest me if Iam going correct or can this be still improved.

The ultimate goal is high quality video streaming. The codec can be any anything like h.2633, h.264 etc.


Source: (StackOverflow)

display smiley in textview and edittext in android

hello i am developing chat application in which i want to insert smiley i have not much idea about it how to integrate and display in it can u give me suggestion for doing the same ?

ImageGetter imageGetter = new ImageGetter() {
    public Drawable getDrawable(String source) {
        Drawable d = getResources().getDrawable(
                R.drawable.happy);
        d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
        return d;
    }
};

cs = Html.fromHtml(
        "<img src='"
                + getResources()
                        .getDrawable(R.drawable.happy)
                + "'/>", imageGetter, null);
System.out.println("cs is:- " + cs);
edttxtemoji.setText(cs);

i found this code, in this it uses images, is this feasible ? or there is another solutions ? please give me better solution for this thanx in advance


Source: (StackOverflow)

PHP Socket Server vs node.js: Web Chat

I want to program a HTTP WebChat using long-held HTTP requests (Comet), ajax and websockets (depending on the browser used). Userdatabase is in mysql. Chat is written in PHP except maybe the chat stream itself which could also be written in javascript (node.js):

I don't want to start a php process per user as there is no good way to send the chat messages between these php childs. So I thought about writing an own socket server in either PHP or node.js which should be able to handle more then 1000 connections (chat users). As a purely web developer (php) I'm not much familiar with sockets as I usually let web server care about connections. The chat messages won't be saved on disk nor in mysql but in RAM as an array or object for best speed.

As far as I know there is no way to handle multiple connections at the same time in a single php process (socket server), however you can accept a great amount of socket connections and process them successive in a loop (read and write; incoming message -> write to all socket connections). The problem is that there will most-likely be a lag with ~1000 users and mysql operations could slow the whole thing down which will then affect all users.

My question is: Can node.js handle a socket server with better performance? Node.js is event-based but I'm not sure if it can process multiple events at the same time (wouldn't that need multi-threading?) or if there is just an event queue. With an event queue it would be just like php: process user after user.

I could also spawn a php process per chat room (much less users) but afaik there are singlethreaded IRC servers which are also capable to handle thousands of users. (written in c++ or whatever) so maybe it's also possible in php.

I would prefer PHP over Node.js because then the project would be php-only and not a mixture of programming languages. However if Node can process connections simultaneously I'd probably choose it.


Source: (StackOverflow)

out of this world Comet programming and a web-based chat

Current Project Setup

I've been working on a web-based chat, similar to Facebook chat. At the current state, I listen for incoming chats and check for new messages in an existing chat is by doing...

setTimeout(function() { listenForIncomingChat() }, 500);
setTimeout(function() { checkForIncomingMessages( ...params... ) }, 500);

... so doing the setTimeout() makes sure these functions are always running. Depending on how many chat windows I have open, Firebug's console can go crazy with POSTs to the server :)

Obviously this is really inefficient, but it is the only way I could get things to work. Now I'm looking for the ways to make it better, to do it correctly!

Some Research

Now, I have heard about Comet Programming and that this is the way to open a long-lived HTTP connection with the server, but I'm not familiar with the technology or the ideas behind Comet. WebSockets for HTML5 is probably even better, but since that is not in full swing nor is it supported by all browsers, I'll stick with what works.

According to Wikipedia, there are several ways to develop with the Comet style: Streaming (hidden iFrame, XMLHttpRequest) or AJAX with long polling (XMLHttpRequest, Script tag). However, I don't know anything about this. I've also read about the AJAX Push Engine (APE) and it looks cool, but I don't want to use a third-party for the time being.

I've recently stumbled upon WebChat 2.0 so I'm going to be looking through the source code to try and understand how it all works.

On to the question(s)

So where can I find example code/tutorials on how to get started with this kind of project? How would I implement the Comet technique? How do I set up the long-lived HTTP connection with the server?


Source: (StackOverflow)

send push notification to ios for chat to offline user, openfire xmpp

I have an ios chat application that uses openfire, what I need to do is send push notification when the message (1) can't be delivered for any reason, (2) app is in suspended state, i.e. can't generate a notification on its own.

I have read most of the related questions/suggestions on this on stackoverflow and elsewhere and I have concluded few solutions to my problem. I am not an ios developer nor did I know anything about openfire or xmpp before a couple of days, so I am afraid my understanding of things may not be complete and my solutions might be flawed.

Kindly confirm my understanding of it and suggest if I am missing something or if there is a better approach. Please also suggest about how complex it is going to be to implement a particular solution listed below.

Challenge here is to identify when the push is required and where the process be initiated, so

1) one way is to use the xep-0184 implementation of xmpp to check if the message is delivered. to do this we should have some delivered flag with message in ios database, which is updated when the delivered response is received form other end. So we need check for this flag after a little while and if the delivered status is false, initiate push process with the message. Looks to be a complicated solution (wait for response.. check flag with some time lag.. not very impressive)

2) A more straight forward approach is to do something in openfire, when openfire can't deliver a message it stores it in offline table, we can do some interception on that part and initiate the push process with the message. This looks to be the correct approach but I am really afraid of getting that much inside openfire and change something(It might be easy also, somebody who has worked a little with openfire can tell?)

3) This is my last resort, and this is not a solution.. but if I can't do it correctly within expected timeframe (which is a week from now) , We plan to send a push notification for all the messages. oppenfire will takecare of normal chat while a push will be sent from our server for each message but when the app is in foreground, we do something to handle the extra push messages that need not be shown, otherwise a push is received whenever there is a message. What do you guys think of this temporary way around (we will of course have to change this as soon as we can), is this doable (or I am missing something here as well).

P.S. Can anyone tell how Whatsapp and other popular apps handle this?

Many thanks for your help.


Source: (StackOverflow)

Ajax polling

In the project i am currently working on, we have the need to develop a web chat application, not a very complex chat, just a way to connect two people to talk about a very specific topic, we don't need any kind of authentication for one of the two users, we don't have to support emoticons, avatars, or stuff like that.

Some project members suggested that we could use XMPP through BOSH, I said that is like trying to catch a fish with a boat's net, and proposed a more simpler method, like a simple Ajax/MySQL web chat, but we're worried about the performance hit in the server because of the constant polling of many chats open at the same time.

Has anyone done something like this before? What would you recommend?


Source: (StackOverflow)