News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Gonzalo Ayuso:
Integrating WebSockets with PHP applications. Silex and socket.io playing together.
February 04, 2014 @ 09:37:25

Gonzalo Ayuso has a new post today showing you how you can integrate websockets with a PHP application using a combination of Silex and socket.io, a javascript library specifically made to work with them.

WebSockets are great. We can start a persistent connection from our browser to our server and use this connection to send real time notifications to our users. Normally when we integrate WebSockets with an existing Web application, we need to face with one slight problem. Our Web application runs on a Web server (imagine, for example one Silex application). We can use a login form and ensure all requests are authorized (using a security layer). This problem is solved years ago. We can use Basic HTTP authentification, Digtest authentification, a session based athentification, token based authentificatio, OAuth, The problem arrives when we add WebSocket server.

He mentions another solution - sharing an authentication mechanism between the frontend and backaned - but suggests something simpler using the bi-directional nature of websockets. To illustrate, he makes a simple Silex application and creates a basic template that makes the websocket request back to the localhost. He includes the simple code to make the socket.io server (node.js) and an example of using Express to handle the request and define the URL to call on the Silex application. He's also created a screencast showing the full process, start to finish.

0 comments voice your opinion now!
websockets socketio silex websockets tutorial authentication security

Link: http://gonzalo123.com/2013/12/24/integrating-websockets-with-php-applications-silex-and-socket-io-playing-together

SitePoint PHP Blog:
Building a Live-score Widget Using PHP Web Sockets
October 17, 2013 @ 10:11:42

On the SitePoint PHP blog there's a new post from Lukas White about using PHP and web sockets to create a "live score" widget to include in your site.

The introduction of web sockets makes it possible for web applications to handle near real-time data without resorting to "hacks" such as long-polling. One example of an application requiring up-to-the-minute data is sports scores. Even now, many websites which display this information use Flash applications, since Actionscript provides the facility to communicate over socket-based connections. However, web sockets allow us to replicate this functionality using only HTML and Javascript. That's what we're going to build in this tutorial, along with a lightweight "server" in PHP.

His example uses the Ratchet PHP library to provide the WebSockets functionality to the frontend script polling for the latest data. He helps you get the library installed and set up a simple directory structure for the example. He includes sample scripts for both the data provider (for the scores) and the WebSocket provider. He talks about maintaining the state of the data and shows how to pull out random data from a set of fixtures (pre-defined data) to send back to the frontend. The Javascript for the frontend script is also included.

0 comments voice your opinion now!
tutorial websockets live score example javascript ratchet

Link: http://www.sitepoint.com/building-live-score-widget-using-php-web-sockets/

7PHP.com:
Win (TWO) Free Tickets To Hear Corey Ballou (Creating Realtime Applications w/Web Sockets)
July 15, 2013 @ 10:03:02

There's a new post on 7PHP.com talking about a new giveaway they're doing in collaboration with the Nomad PHP (virtual) user group and giving away two tickets for the upcoming meeting.

NomadPHP is already on their 3rd edition and I'm hence also on my 3rd Ticket(s) give-away. [...] The topic of this 3rd talk will be centered around PHP and Websockets and will be presented by speaker Corey Ballou.

There's two ways to enter into the contest - either subscribe to their mailing list or Tweet about it (with the given tweet). The contest ends July 21st, so hurry and enter if you're interested. The Nomad PHP user group is "a (virtual) place to call home" if you don't have a user group in your area. It meets online once a month.

0 comments voice your opinion now!
contest tickets coreyballou realitme websockets nomadphp

Link: http://7php.com/nomadphp-july-2013-free-tickets

Nomad PHP July 2013:
Corey Ballou - Creating Realtime Applications with PHP and Websockets
July 04, 2013 @ 13:19:26

The Nomad PHP virtual user group has announce the latest meeting - this time it's Corey Ballou presenting about realtime applications and WebSockets in July.

We'll start out with a brief introduction to WebSockets to get everyone up to speed before jumping in to high level scaffolding code of the frontend and backend implemetations (the spec). Once the groundwork has been laid, I'll introduce you to a both client and server side tools for implementing WebSockets directly in your PHP code. From here, we'll jump into multiple interactive demos of increasing complexity utilizing the open source Ratchet library. I'll walk through the source code of the first two intro demos to give you a better sense of how to structure your own WebSockets applications

If time allows, I'll run through a complex demo where I introduced WebSockets to an existing CRUD todo application. The last demo is not for the faint of heart. By the end of the presentation, you'll walk away with access to a github repository containing all of the presentation slides and demos ready to run yourself!

You can pick up your tickets for this meeting (happening July 25th) directly from the Nomad PHP site.

0 comments voice your opinion now!
nomadphp coreyballlou realtime applications websockets virtual usergroup

Link: http://nomadphp.com/2013/06/06/july-2013/

PHP Town Hall Podcast:
Episode #7 - Web Sockets Are Fast
May 20, 2013 @ 11:41:55

The PHP Town Hall podcast has posted a new episode - Episode #7: "Web Sockets Are Fast".

Chris Boden joins us to talk about a Ratchet and React. The conversation is basically Ben and Phil asking a bunch of questions about how Ratchet works, pretending we know what is going on while Chris uses lots of words like "concurrency" and "non-blocking". We decide that PHP is web-scale, event-driven programming is not just for NodeJS hipsters, we all take the "Are You a Brogrammer" test and Michael Wales crashes the show half way through like a ninja.

You can listen to this latest episode either through the in-page player or by downloading the episode directly. You can also subscribe to their feed if you'd like the latest shows as they're released.

0 comments voice your opinion now!
podcast phptownhall websockets philsturgeon benedmunds

Link: http://phptownhall.com//blog/2013/06/18/episode-7-web-sockets-are-fast

Web & PHP Magazine:
Issue #12 - Don't Get in a PECL
March 08, 2013 @ 10:23:36

The latest issue of the Web and PHP Magazine has been published - issue #12, "Don't get in a PECL". This latest issue includes articles like:

  • "The Power of PECL" by Simon Holywell
  • "Be 'ready' if you want to be done!" by Steffan Surdek
  • "All Data is Relational" by Cory Isaacson
  • "Fixing PHP Production Problems with APM" by Dan Delany and Chris Kelly
  • "Trust" by Sebastian Bergmann

You can download your copy for free from their site and catch up on back issues.

0 comments voice your opinion now!
webandphpmagazine issue pecl recursion relational data websockets


James Morris:
A WebSockets, Ratchet, Silex and Redis PubSub Implementation
January 23, 2013 @ 12:09:33

James Morris has an interesting new post to his site about the creation of a real-time web service that could be used for iOS applications via Websockets. He chose Ratchet for the handling (a PHP-based websocket tool) combined with Redis and Silex.

I was approached by a betting/gambling development company who potentially needed a middleware building that would pull from an existing gambling web service and basically transmit to connected iPhone clients the changes from the web service. At first, the obvious answer might be to create another REST web service that the iPhone clients could just ping for changes. However, one of the devs explained that this wouldn't be fast enough, or scale - they'd need changes to be transmitted as soon as possible, as the app would be a real-time betting app and there'd be thousands of connections to the server.

His solution involved hooking together Ratchet, Redis, Silex and Predis-async to create this sample tool for handling the websocket requests. it uses the "pubsub" mechanism of Redis to push the updates out to listening clients.

0 comments voice your opinion now!
realtime websockets silex pubsub redis ios application api


Pivory.com:
From Ajax to WebSocket with PHP, a Quick Example
August 31, 2012 @ 10:41:28

On Pivory.com there's a new topic (tutorial) showing you a simple example of using WebSockets with the Ratchet PHP library, complete with sample code.

WebSocket is the modern way for realtime two-way communications between server and browser. In the beginning we have Ajax calls [...] and with WS in picture the logic becomes [different]. [There] is a separate WS server, say listening on xxx.xxx.xxx.xxx:8080, and it can send messages to connected clients in realtime at any moment. The WS server can be in any language (such as node.js + socket.io) and on any machine or even in a cloud service. I use PHP (try http://socketo.me for Ratchet) because I am lazy.

The example shows a basic PHP Web Socket server running on a port with methods for "on connect", "on close", "on error" and "on message send". There's an example of the Javascript code to connect to this socket, showing how to convert it over from Ajax usage.

0 comments voice your opinion now!
websockets tutorial ratchet library server


NetTuts.com:
Getting Real-Time with Pusher
October 05, 2011 @ 08:39:52

On NetTuts.com today there's a new tutorial showing you how to implement the Pusher service that gives you real-time messaging for your application. Their backend for the project is written in PHP using Pusher's library.

Do you want to spice up your web applications by making them real-time - but don't want to create new infrastructures for the sole purpose of getting web sockets to work? In this article, we'll explore how to use and implement Pusher, an HTML5 WebSocket-powered real-time messaging service for your applications.

Pusher uses HTML5 WebSockets to handle the messaging, so you'll need a browser that supports it to follow along with the tutorial. The Pusher API provides and endpoint for authorization and the push and pull of messages. In the tutorial, they create a simple chat application that gives a "Who's Online" and a window with the latest messages. You can download the full source (Javascript and PHP) here or view a demo here.

2 comments voice your opinion now!
realtime messaging pusher service websockets tutorial


Gonzalo Ayuso's Blog:
Real time monitoring PHP applications with websockets and node.js
May 09, 2011 @ 11:02:28

Gonzalo Ayuso has a new post to his blog today looking at a method you can use for real-time monitoring of your PHP applications with a combination of websockets and Node.js. The trick is to handle the PHP errors and send them over to a Node.js server for processing.

The inspection of the error logs is a common way to detect errors and bugs. We also can show errors on-screen within our developement server, or we even can use great tools like firePHP to show our PHP errors and warnings inside our firebug console. That's cool, but we only can see our session errors/warnings. If we want to see another's errors we need to inspect the error log. tail -f is our friend, but we need to surf against all the warnings of all sessions to see our desired ones. Because of that I want to build a tool to monitor my PHP applications in real-time.

The service will work similar to a chat server, sending messages one at a time to the remote server via a web client (HTML5-based) and some backend PHP. He includes all the code you'll need to create the HTTP and web socket server as well as the web client (with some Javascript) and some example server-side PHP. It throws an exception and catches it to send to the waiting Node.js server. A screencast is also included showing the full process. You can get the complete code for this example in this repository on Gonzalo's github account.

0 comments voice your opinion now!
nodejs realtime monitoring websockets javascript tutorial



Community Events





Don't see your event here?
Let us know!


opinion interview language code introduction install laravel testing unittest developer framework podcast symfony2 refactor release threedevsandamaybe community list experience series

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework