PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, April 13, 2022

[FIXED] how to send event to the client after specified time in web socket(pusher) Laravel?

 April 13, 2022     laravel, phpwebsocket, pusher, websocket     No comments   

Issue

I am beginner in Web Socket. i am building an online exam system. i already have timer coundown system.so while any student taking an exam, JavaScript sends an ajax request every second to the server, so when countdown < 0 then JavaScript reloads the page to stop exam.

but now i want to achieve this functionality with web socket. how to broadcast an event to the clients when the specified time passed.i am using pusher with laravel.


Solution

In Your Exam model add started_at attribute. Then make function which will run every minute (https://laravel.com/docs/5.7/scheduling#introduction) and check if time is expired. If it is just send an event to client using Pusher and reload the browser



Answered By - r00t
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing