sorry that was a bit presumptuous of me. it can also be ur firewall as u hinted, or the other persons firewall when u are live on internet, or it can be the webrtc is not supported on some end.
i said that because the code looks rather weird, comparing it with how the tutorial of chat message works, and order of things. yours is using the sending message code right, but everything else is backwards.
for one that line there, ur using, works for localhost for some reason..... i have no clue why(probably cause u are both on the same connection? if ur running from the same device on two browser tabs?), however, id change the else condition to a inversed condition of is host... else sometimes if not used properly can mean anything making the system confused, especially when is followed by another else on a bellow condition that we might not see.
also if u change the else condition to a inverse condition, make sure the host coding is always last, as u would want that to be always checked last not the peer.
but if its working in preview should work online ... however that is not always the case with all the construct objects, can we see the multiplayer code in a separated capx file that wouldn't make ur game public? i wanna alter it a bit. because some of the send data coding ur using.
or u can check this file here and compare what is wrong on ur end, to connection to server and message coding.
Edited: --- disregard the P.S--- this is meant to be read quietly... it can also be a bug.... shhhhh
have u tried ur code on different versions on C3? what is ur current one ur using?
there are various reasons why doesn't work once u go live.... but 90% of the cases is the code.