PHP Jabber Integration - php

I am wondering how to integrate jabber instead of using my AJAX polling script. I chanced upon the following: http://code.google.com/p/xmpphp/
It gives me access to a jabber server, but does not tell me how to exactly go about it. I mean for example
$payloads = $conn->processUntil(array('message', 'presence', 'end_stream', 'session_start'));
Are there a fixed set of commands that I can use? Is there some site which explains the jabber workflow in very simple terms?
Thank you very much for your time.

I've been wondering about technologies to play around with XMPP, been looking at:
Strophe
BOSH
Examples of this technology can be seen at:
drop.io
Chesspark

These two doc pages seem to be fairly readable:
Core
Instant Messaging and Presence
Also, you might already be heavily invested into xmpphp, but if not, you may want to take a look at Phurple. It gives you access to the libpurple library (the code-base for Pidgin) from PHP.
From the project page:
This libpurple PHP binding, which
defines a set of internal classes,
gives a possibility to use aol and icq
(oscar), yahoo, msn, jabber, irc and
much more protocols directly from PHP.
Write your own IM chat client in PHP,
as simply as PHP enables it.

Related

implementing a chat webapplication

I need to develop a web application with a chat feature, and I would like to know if there are any sophisticated ways to create a realtime web-application with a push engine.
I know jQuery, and I can handle to create a chat web-application which, in the client side, check every period for new messages, and show them, but I don't like this solution and I was wondering if there are any better ways to do it.
In my research I discovered the existence Ajax Push Engine project, and it looks like what I need, but when I was navigating in their website I found it not very well done and somehow incomplete, so I was wondring if there API is stable enough to be put in a production environment if not are there any other solutions?
Sorry if I made it long, any help/hint/link/suggestion would be very welcomed :)
EDIT
I would like to specify that I'm working with PHP in the server side
Here is an implementation in NodeJs.
http://dhotson.tumblr.com/post/271733389/a-simple-chat-server-in-node-js
I recently (year 2012) developed an application in ASP.NET MVC3 where I used SignalR for real-time messaging between server and client. At their own site, they describe SignalR like this:
ASP.NET SignalR is a new library for ASP.NET developers that makes it incredibly simple to add real-time web functionality to your applications. What is "real-time web" functionality? It's the ability to have your server-side code push content to the connected clients as it happens, in real-time.
... and they give the following example of what you can use SignalR for:
SignalR can be used to add any sort of "real-time" web functionality to your ASP.NET application. While chat is often used as an example, you can do a whole lot more. Any time a user refreshes a web page to see new data, or the page implements Ajax long polling to retrieve new data, is candidate for using SignalR.
Further, based on my experience, I believe it is very simple to set up, easy to use, and have a good github page with well-written documentation that gets you going in no time. I can highly recommend it :)

C2DM Application Server solution

Can anyone recommend a tutorial or point me in the direction of some easily implemented .net or PHP code that i could use to setup a third party application server for C2DM.
I am a Front-End Developer with some PHP/.net experience, but very minimal Java experience, our app is setup with the required java code/classes and I have registered with C2DM, but i'm struggling with the application server part of the equation.
I would like to setup a server application that can handle form requests to send a message out to our app.
Any help or advice would be greatly appreciated!
The server part of C2DM is a piece of cake compare to the client (in my opinion). You can find below some tutorials about the server part :
One for JAVA very easy to understand even if your are not JAVA developper.
One for PHP and Zend framework.
A basic example for C# on stackoverflow
A common mistake to avoid if you want some performance : Don't connect for each message to send.
You just have to auth one time to the google server and then you can send multiple notification message.
Also don't forget that Google will periodically refresh the token in an Update-Client-Auth header. You should handle this header to keep your tokens up to date. Have look to this discussion about it
You may want to have a look at this post. It is a basic PHP implementation using curl.
I am building a server-side C2DM based on Drupal CMS.
While it is not 100% ready, if you want I can try and help you building it.
Using Drupal as the server-side, and its amazing modules such as Services and Rules, you can create a very interesting applications very easy, almost "out-of-the-box".

What is the best way to connect an android application and a php server using sockets?

What is the best way to connect an android application and a php server using sockets? I am trying to implement a chat system between multiple clients, but I know that PHP does not allow multithreads.
Sorry for not giving enough information about what I intend to do. I basically want to create an app simmilar to google latitude, and I also want to implement a chat system between the users. I have aldready decided that I am going to use a MySQl DB and therfore a PHP server so the client communicates with the DB using JSON for data exchange. I am quite new to this and I don't know how the architecture Client-Server-Client communication should look like. I found out that the easiest way to do this is using HTTP requests, but I don't know how I should implement this.
I think you can use jabber protocol, install any xmpp server and you can connect to that from android, this is standard for chat applications
use xml-rpc base php webservices for chat server. your chat client will contact to chat server throught web services.
*I was going to make this a comment but I ran out of space, plus it does have some answer-y qualities to it.
This question does not contain nearly enough information for anyone to usefully help you. How do you think it should be done? You can't ask people to critique an idea when you haven't told them what your idea is.
PHP is the wrong language for this, because (as you rightly point out) it can't be multi-threaded - amongst a multitude of other reasons. I personally would recommend Node.js (or possibly Java), but that's just my preference.
If you still insist on using PHP, take a look at this. It might give you a point in the right direction for a non-blocking multi-IO setup such as this - but you're letting yourself into a whole world of unnecessary complication by doing this in PHP.

Chat system in Zend Framework website

In my website, I have to make a chat system similar to Gmail so registered users can chat with their group. I have no idea about how I will do this. Can anyone provide me with an idea of how to implement this or any useful links? I have to do it using Zend Framework.
Since you are looking to work this out using Zend framework, have a look at Jaxl library (Jabber XMPP Client/Component Library). The library can be integrated with any existing website/framework and also contains several examples for browser based chat applications.
Actually there are two parts for chatting:
A long running request that streams massges from the server to the client
Ajax messages from the client to the server that sends one message to the server
For the second, any ajax framework will do it. For the first you might have a look at Comet to get the idea for this. But you should be aware that html isn't ment to be a chatting protocol. If you don't pay attention such stuff can easily kill your server.

Is it just me...or is "Facebook Mobile Web" only for PHP?

http://wiki.developers.facebook.com/index.php/Mobile
I use Django/Python as my mobile website.
Am I missing something?
The library may be "officially' for PHP, But that doesnt stop you from making your own.
I would suggest looking at the API. You may be able to port the calls to python using python's httplib.
All the PHP library does is make curl POST and GET calls to Facebook's REST server.
If you are familiar with PHP or Javascript you may be able to look at the library and port the methods yourself.
I suggest a quick google search starting with: python facebook api
edit: In fact I just found: pyfacebook or pyfacebook (on github) These might be a good starting point for you also.
If I wasnt behind a restrictive work firewall I would pull up some API examples. sorry.
"Facebook Connect for Mobile Web is a PHP library..."

Categories