Problem Description
When playing a game via NWjs, the multiplayer plugin reports that it is unavailable on this platform.
This was likely caused by updated r253: https://www.scirra.com/construct2/releases/r253 as r253 changed/added to
how the Multiplayer plugin checked for availability.
The code below from c2mp.js of the Multiplayer plugin will always be undefined in NWjs, which leads the Multiplayer plugin to never be able to connect.
var RTCDataChannel = window["RTCDataChannel"] || window["DataChannel"] || window["webkitRTCDataChannel"] || window["mozRTCDataChannel"] || window["msRTCDataChannel"];[/code:3ghc4of9]
[b]Attach a Capx[/b]
[url=https://drive.google.com/open?id=1Jh2jYr4_0f6fWHHAHz7FYmJZVaOJGTeH]https://drive.google.com/open?id=1Jh2jY ... JZVaOJGTeH[/url]
[b]Description of Capx[/b]
Basic Multiplayer chat sample Capx + Opens dev tools on startup.
[b]Steps to Reproduce Bug[/b]
[ul]
[li] Export the Capx to NWjs
[/li][li] Run the exported game on any platform (win, mac, linux)[/li][/ul]
[b]Observed Result[/b]
A large "Multiplayer is not available" message is present & no connections are possible
Additionally, if you paste the code I mentioned above into the dev tools that appear, note that it returns `undefined`
[b]Expected Result[/b]
Multiplayer should work as expected in releases pre r253
[b]Affected Browsers[/b]
[ul]
[li] NWjs: All platforms (win, mac, linux)
[/li][li] Chrome: (NO)
[/li][li] FireFox: (NO)
[/li][li] Internet Explorer: (NO)[/li][/ul]
[b]Operating System and Service Pack[/b]
Win7 SP1
[b]Construct 2 Version ID[/b]
r255 64-bit
[b]NWjs Version[/b]
NWjs 0.19.4
[b]Work Around[/b]
Having this issue and need to release something with NWjs? Just follow these steps in the meantime <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">
[ul]
[li]Open Construct 2/exporters/html5/plugins/multiplayer/c2mp.js[/li]
[/ul][code:3ghc4of9]
// Change this line
return !!RTCPeerConnection && !!RTCDataChannel && typeof ArrayBuffer !== "undefined" && typeof DataView !== "undefined";
// To this
return !!RTCPeerConnection && typeof ArrayBuffer !== "undefined" && typeof DataView !== "undefined";
// Done!
[/code:3ghc4of9]