3 Replies - 620 Views - Last Post: 05 October 2012 - 01:45 PM

#1 CasiOo  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1275
  • View blog
  • Posts: 2,837
  • Joined: 05-April 11

qwebirc - how does it work?

Posted 05 October 2012 - 08:13 AM

I have been studying qwebirc trying to figure out how they manage to do their client-server messages.

Do they use ajax to send messages back and forth?
I have tried to find the source code where they do the ajax calls in the javascript, but I can't really find out how they do it.

If I understand AJAX correct, then the client has to send request to the server which then returns a response, and the server cant send requests to the client.
Isn't this very inefficient since the client always have to ask if the server has got any new messages?

I want to make a webchat myself that works in the browser, and that is why I want to know how qwebirc is working :)

Is This A Good Question/Topic? 0
  • +

Replies To: qwebirc - how does it work?

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3389
  • View blog
  • Posts: 9,577
  • Joined: 08-June 10

Re: qwebirc - how does it work?

Posted 05 October 2012 - 11:26 AM

View PostCasiOo, on 05 October 2012 - 05:13 PM, said:

If I understand AJAX correct, then the client has to send request to the server which then returns a response, and the server cant send requests to the client.
Isn't this very inefficient since the client always have to ask if the server has got any new messages?

If you want to make a chat system - yes. but AJAX was never meant to be for a chat application in the first place.



View PostCasiOo, on 05 October 2012 - 05:13 PM, said:

I want to make a webchat myself that works in the browser, and that is why I want to know how qwebirc is working :)

I dinít look into qwebirc too much, maybe they used sockets. (and since WebSockets are available in modern browsers).

for a chat application look into node.js and socket.io.
Was This Post Helpful? 1
  • +
  • -

#3 CasiOo  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1275
  • View blog
  • Posts: 2,837
  • Joined: 05-April 11

Re: qwebirc - how does it work?

Posted 05 October 2012 - 01:11 PM

More information on the node.js and socket.io part will be great :)

What would you say is the main differences between socket.oi and node.js?

I would like to use just WebSocket, but apparently not many browsers support it yet. But both node and socket.oi support websocket through flash?
Is socket.io a library on top of node.js?

I should also note that I want to write my server in c# or java, but node.js and socket.io seems to be having their own server thingy?
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3389
  • View blog
  • Posts: 9,577
  • Joined: 08-June 10

Re: qwebirc - how does it work?

Posted 05 October 2012 - 01:45 PM

though itís not immediately obvious (except for the npm install socket.io part (npm = node package manager)) socket.io is a node.js module. more information you will find in their documentation.

and yes, node.js needs to be installed on the server (which is, say, less than common). but itís the perfect environment for a chat application.



Quote

But both node and socket.oi support websocket through flash?

node.js is just the server environment (but it does provides the server bindings for sockets). socket.io deals with the WebSockets, and if they are not supported natively, it uses one of the other possibilities: http://socket.io/#browser-support
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1