Dark Bit Factory & Gravity

PROGRAMMING => Other languages => Topic started by: combatking0 on April 29, 2013

Title: AJAX - The Chat Demo
Post by: combatking0 on April 29, 2013
A few people have been throwing around the idea of a PHP / JavaScript demo, and the first thing that popped into my head was the use of AJAX.

It is possible to hook the AJAX output into a canvas at the client side, and a database on the server side.

Users should then be able to post messages to the database (like a shout box) which are read back in real time into the canvas, which applies effects to the text, such as rendering it as cubes or some other inventive method.

I'll see how far I can run with this idea.
Title: Re: AJAX - The Chat Demo
Post by: Clanky on June 11, 2013
Could having an interval check calling AJAX to grab the posts from the database work? Once you have have the JSON (or a plain response) you can push those posts to the Canvas Object? Shouldn't be too hard? You could employ simple 2D polygons to give the impression of a cube and use transformations on the text to get it positioned on the cube. Or, you could use WebGL and create a proper 3D cube on the Canvas. WebGL also offers wider effects for text, shapes, graphics etc.

Have you thought of using HTML5 Web Sockets to act as a tunnel from the client to server, which would eliminate the need for AJAX and an Interval. It allows for proper real-time data streaming.
Title: Re: AJAX - The Chat Demo
Post by: combatking0 on June 12, 2013
Good ideas - I'll look into webGL.

My current host won't let me use server sockets, but I'll see what I can do with a LAN setup just to test them.