# WebSocket extension (experimental)

**URL:** https://forum.makecode.com/t/websocket-extension-experimental/4661
**Category:** Arcade
**Created:** [November 27, 2020, 1:41pm UTC](https://forum.makecode.com/t/websocket-extension-experimental/4661 "2020-11-27T13:41:24Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)
#### Post date: [November 27, 2020, 1:41pm UTC](https://forum.makecode.com/t/websocket-extension-experimental/4661/1 "2020-11-27T13:41:24Z")

</div>

This extension provide a WebSocket like API to build multiplayer game on the web (and hardware). It’s still very much a work in progress. **Read below, it will not work as is in the editor**.

- demo [https://pelikhan.github.io/pxt-sockets/](https://pelikhan.github.io/pxt-sockets/)
- github [https://github.com/pelikhan/pxt-sockets](https://github.com/pelikhan/pxt-sockets)

The simulation support is rather clunky right now because it can’t be tested in game yet. However if you copy custom.js/loader.js into your generate repo, you’ll be able to talk to WSS.

---

<div class="post-metadata">

### Author: ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)
#### Post date: [November 27, 2020, 7:20pm UTC](https://forum.makecode.com/t/websocket-extension-experimental/4661/2 "2020-11-27T19:20:07Z")

</div>

YESSSSSS!!!

@livcheerful now we need to make a Mahjong game in Arcade. (The traditional one obviously) 🙂

Maybe you could run a hash on the `.js` file and only run files that match the hash?

I also don’t see any blocks for it yet…but that obviously will come later.

I also realized that resetting the simulator on the Github pages using the reset button on the sim seems to break it. Only reloading the page seems to fix it.

---

<div class="post-metadata">

### Author: ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)
#### Post date: [November 27, 2020, 9:29pm UTC](https://forum.makecode.com/t/websocket-extension-experimental/4661/3 "2020-11-27T21:29:58Z")

</div>

YES! Mahjong! Aaaaargh … too many projects already this weekend…

Thanks for this, @peli ! I’ll look at retrofitting some of my games that naturally lend themselves to multiplayer (e.g. Salvo).

---

<div class="post-metadata">

### Author: ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)
#### Post date: [November 28, 2020, 3:38am UTC](https://forum.makecode.com/t/websocket-extension-experimental/4661/4 "2020-11-28T03:38:36Z")

</div>

I love that Salvo game! It’s just like battleship. And yes @UnsignedArduino! Mahjong is something we need too. Let’s go!!

---

<div class="post-metadata">

### Author: ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)
#### Post date: [November 29, 2020, 10:01am UTC](https://forum.makecode.com/t/websocket-extension-experimental/4661/5 "2020-11-29T10:01:27Z")

</div>

Yes right now we don’t reset the websocket on reset, so we leak it and eventually it’s broken. I need to clean our “loader” story to be easier and a bit more robust. Also i need to document how to get the dev experience right.

---

<div class="post-metadata">

### Author: ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)
#### Post date: [November 30, 2020, 9:20am UTC](https://forum.makecode.com/t/websocket-extension-experimental/4661/6 "2020-11-30T09:20:38Z")

</div>

Fixed the restart issue.

---

<div class="post-metadata">

### Author: ![danger\_kitty](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/danger_kitty/32/32006_2.png) [@danger\_kitty](https://forum.makecode.com/u/danger_kitty)
#### Post date: [May 31, 2022, 4:33pm UTC](https://forum.makecode.com/t/websocket-extension-experimental/4661/7 "2022-05-31T16:33:28Z")

</div>

Hi @peli if I wanted to open a web site like a link to another game using this how could I do that

---

<div class="post-metadata">

### Author: ![Stickman4269](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/stickman4269/32/23582_2.png) [@Stickman4269](https://forum.makecode.com/u/Stickman4269)
#### Post date: [January 7, 2025, 5:31pm UTC](https://forum.makecode.com/t/websocket-extension-experimental/4661/8 "2025-01-07T17:31:26Z")

</div>

Will there be blocks for this soon?

---

<div class="post-metadata">

### Author: ![Jedi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jedi/32/14307_2.png) [@Jedi](https://forum.makecode.com/u/Jedi)
#### Post date: [January 8, 2025, 12:24am UTC](https://forum.makecode.com/t/websocket-extension-experimental/4661/9 "2025-01-08T00:24:18Z")

</div>

likely not bc this extension was made 5 years ago  
also please dont reply to old topics like this
