ID:2739784
 
(See the best response by Multiverse7.)
Code:
None to show


Problem description:

I'm just now playing around with the webclient, as I feel it'll be useful for my next project. I'm trying to connect using http://www.byond.com/play/localhost:myport (replacing myport with the actual port I have opened), and I get "BYOND Error: failed to certify (null) from 127.0.0.1, origin localhost:myport from Dream Daemon

I've had a friend try to connect and it's hanging up at 99% download completion and it then spits the same error at me.

My ports are open. Connections can be received when made using Dream Seeker.

Any help would be appreciated.

screenshot: https://i.imgur.com/44qTuIg.png (blanked out the IP addresses and port information)
Best response
Please try the steps that I posted here: http://www.byond.com/forum/post/2728161#comment25991285

That should allow you to bypass the error until the webclient is fixed. It's not ideal, but I'm sure you can partly automate the process.

I have a kind of webclient launcher that's supposed to make it easier to do this, but it's not yet complete. It works as a sort of mod for the webclient. If you place a file named something like "!!!!!!!( redirect )!!!!!!!.js" in "[installed_programs_location]\BYOND\web", this will be loaded before almost everything else. Then you can use MutationObserver to gain full control over when and how the webclient loads. From there you can setup a URL redirection system that includes a popup window containing the BYOND home page and another one with a button to continue to the actual webclient. The following code can help you get started:

function istopwindow(win) {
var w;

if (win) {
w = win;
} else {
w = window;
}

try {
if (w.self === window.top) {
return 1;
} else {
return 0;
}
} catch (e) {
return 0;
}
}

function webclientShow() {
// Tries to send a message to the parent byond.com window, instructing http://www.byond.com/rsc/webclient.min.js that the webclient is ready to be shown, hiding the "backdrop" to reveal it.
if (!istopwindow()) {
try {
window.parent.postMessage("ready", "*");
} catch (e) {
return;
}
}
}

function webclientPopout() {
// Tries to send an internal command message to the parent byond.com window, instructing http://www.byond.com/rsc/webclient.min.js to "popout" the webclient, maximizing the webclient's iframe.
if (!istopwindow()) {
try {
window.parent.postMessage("command::popout", "*");
} catch (e) {
return;
}
}
}

var __wcbypass_observer;

function webclientBypass(html, style, css) {
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;

if (MutationObserver) {
__wcbypass_observer = new MutationObserver(function(mutations, observer) {
var m;
var nodes;
var n;
var src;
var isfirefox;
var bselistener;

if (window.navigator.userAgent.indexOf("Firefox") > -1) {
isfirefox = 1;
bselistener = function(event) {
event.preventDefault();
event.target.removeEventListener("beforescriptexecute", bselistener);
// cleanup
}
}

for (var mi = 0; mi < mutations.length; mi++) {
m = mutations[mi];
nodes = m.addedNodes;
for (var ni = 0; ni < nodes.length; ni++) {
n = nodes[ni];
if ((n.nodeType === 1) && (n.tagName === "SCRIPT")) {
// if the node is a script element
src = n.getAttribute("src");
if (!src || (src == "/res/webclient.dart.js") || (src == "/res/ext.js")) {
n.setAttribute("type", "text/plain");
if (isfirefox) {
n.addEventListener("beforescriptexecute", bselistener);
}
}
}
}
}
});

__wcbypass_observer.observe(document.documentElement, {subtree: true, childList: true});
// begin observing
} else {
console.error("The current browser does not support MutationObserver. Try updating, or use a newer browser.");
}
}


If you know JavaScript, that should be enough to help you get started. The second part of webclientBypass() (not shown) adds an event listener to "load", where the entire HTML document is effectively replaced with a custom one. That's what those arguments are for.

Login to reply.