PHP Jabber Stupid Question

Not sure what I'm doing is absolutely correct. But here goes:

  • The user enters the chat via the web interface.
  • The user is informed about updates through Comet
  • The user enters data that transfers the PHP file, which then connects to the Jabber server.

Now the problem is that when the user wants to send a message, its simple to run php, in which I connect to the jabber server and send the message. The problem occurs when I wait for a message. The reason is, if I log in and check the messages and disconnect, on other users I will show that it is disabled.

Am I approaching this problem incorrectly? Should I connect directly to the Jabber server (via javascript) instead of the PHP layer between them? How to receive messages through PHP?

Thank you for your time.

+3
source share
3 answers

This is an inherent problem (or function) with http - there are no strong connections (not real). you need a workaround, there is no real solution.

you could do it using java or flash, but this is not very nice (javascript 4tw!).

another possibility would be to create an intermediate client that transfers the connections between the browser and the web server to the connections between the web server and the jabber server. dirty but possible.

or maybe there is an API that helps with this.

jabber- javascript
, , -, , -html ( greasmonkey ). , , . jabber-, chatpage-html , . , , . mozilla, COMET . , .

0

, xmpphp. -, XMPP (, Jabber-) , . , - -, .

, JavaScript, , . , , . , Strophe, .

XMPP, , - headstock, python Kamaelia.

+1

, , , , Jabber . , , , Jabber, , php script , , ( script , ).

, , :

  • php script, Jabber ,

  • AJAX (AJAX script, script .)

  • Javascript, script 10 , , . , .

:

1) , , php script / ?

2) , ajax 3 , , .

2:

OpenFire jabber server. -, , Fastpath, HTML (, " !" ).

We use this at work and are very customizable, we can integrate with other scripts (for example, if you want the script to fill in user data from their username or add some kind of user avatar or something else), and it has (OpenFire ) there are many other extensions and add-ons that, if that's not what you want, they probably have what you are looking for.

0
source

Source: https://habr.com/ru/post/1708078/


All Articles