Search the Community
Showing results for tags 'websocket'.
-
I’m currently trying to building a websocket widget, using node package manager(NPM),WAMPserver and electronjs. the package was well installed because when i start it it works. It log into the console But i dont know how i can handle it with html on wamp server . it seems electronjs is not working for wamp and websocket.
-
I have a very troubling problem at hand. I am using a web-socket server that runs in PHP. The issue is I need to be able to use a setInterval/setTimeout function similar to javascript, but within my php server. I do not have the time or resources to convert my entire project over to nodejs/javascript. It will take forever. I love php so much, that I do not want to make the switch. Everything else works fine and I feel like it's not worth it to re-write everything just because I cannot use a similar setInterval function inside php. Since the php socket server runs through the shell, I can use a setInterval type function using a loop: protected function on_server_tick($counter) { if($counter%5 == 0) { // 5 seconds interval } if($counter%10 == 0) { // 10 seconds interval } } $this->last_tick_time = microtime(true); $this->tick_interval = 1; $this->tick_counter = 0; while(true) { //loop code here... $t= microtime(true) - $this->last_tick_time; if($t>= $this->tick_interval) { $this->on_server_tick(++$this->tick_counter); $this->last_tick_time = microtime(true) - ($t- $this->tick_interval); } } This code does work as intended, but it seems a bit overboard for resources and I feel like that while loop will suck a lot resources. Is there anyway I can re-compile PHP from source and include a "while2" loop that only iterates every 500 miliseconds instead of instantly?
-
i am new with web socket and in same time I try to make server and client communication for soccer manager application, and for this purpose, i need to create closed "chat rooms" or "games" where two users can watch (read game event) and menage (create) game event (make substitution, formation ... or if you want, to send message to server, that they make changes in formation) this game (room) mast bi secret, and only this two player can use this game for "read" and "write" events in game for example: Game no: 200001 between user A and user B in 14.05. when User A, and User B click on game no. 200001 they can read and write game event. PS: for now, i create basic chat aplication with PHP, jQuery and webSocket and in this app, all user see wath all other user do (public chat) and i want to make secret chat for specific user (already automate subscribed from server) All work with no problem (i work on this example http://www.sanwebe.com/2013/05/chat-using-websocket-php-socket) How i can create chat room(s) and subscribe user to specific chat room? Thanks
-
Hi guys, this is my first post in phpFreaks i have designed a chat application using php, in the client side i used html5 websocket. i run my php file once to handle request, if processing restart anyway ,what's happen for connections ? is connections still opened ? how can have persistent connection using php and client side(web socket) ? another question is how i can manage user connections for administration purpose? thanks