Skip to content

frontandrew/shared-worker-lesson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shared Worker Lesson

This project demonstrates the use of a Shared Worker in a web application. A Shared Worker allows multiple scripts to communicate with each other and share a single worker thread.

Project Structure

  • index.html: The main HTML file that sets up the user interface.
  • index.js: The JavaScript file that handles the interaction between the user interface and the Shared Worker.
  • worker.js: The Shared Worker script that manages messages between different clients.

How to Run

The project must be run on the server. You can use one of the solutions that suits you.

  • Using Node.js http-server.
  • Using Python's SimpleHTTPServer.
  • Using Live Server Extension in VS Code.
  1. Open index.html in a web browser that supports Shared Workers.
  2. Open multiple tabs with the same index.html file to see the Shared Worker in action.

Features

  • Multiple clients can connect to the Shared Worker.
  • Messages sent from one client are broadcasted to all connected clients.
  • The user interface updates in real-time to display messages from all clients.

Browser Support

This project requires a browser that supports Shared Workers. If Shared Workers are not supported, an error message will be displayed in the console.

License

This project is licensed under the MIT License.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks