Search code examples
phpjquerywebsocketcometpush

State of Push in web development


What is the current state of Push technology in web development? I heard solutions like Comet as described in this article are not used anymore and instead WebSocket is the future for this kind of features, but it's only supported in Chrome and Safari.

What is the best technique to use?

I'm developing a game where many players (between 2 and 4) can seamlessly interact with each others. I'm using PHP server side and Jquery in client side.


Solution

  • There is a solution that will work in older browsers. I don't know the finer details but I'm sure liking the blurb: (see query-graceful-websocket)

    The Graceful WebSocket

    So, you want to start building realtime event driven applications using the new HTML5 WebSocket API?

    • You want it to work in all browsers, no matter if they have WebSocket support or not
    • You don't want to rely on proprietary technology such as Flash to provide a fallback
    • And naturally, you don't want to write more than one implementation

    Introducing, the gracefulWebSocket jQuery plugin:

    • Implements the w3c WebSocket interface
    • Wraps the native WebSocket if support is detected
    • Provides a default fallback using traditional AJAX polling over HTTP
    • Requires no extra code on the frontend, allows you to target the WebSocket API today and let users take advantage of it as more browsers add support.
    • Default fallback behavior can be overridden by plugin options

      https://github.com/ffdead/jquery-graceful-websocket