Bug #1363
closedMozilla + IPv6 + WebSockets = not working
0%
Description
Websockets don't function in Firefox 13.0.1 whenever I use an IPv6 address. They work in Chrome.
I'm using ::1
as the listening address.
Example:
#include <Wt/WApplication>
#include <Wt/WPushButton>
class Application: public Wt::WApplication
{
public:
Application(const Wt::WEnvironment& env) :
Wt::WApplication(env),
flipflop(false)
{
this->button = new Wt::WPushButton("Pink", root());
this->button->clicked().connect(this, &Application::eventHandler);
}
void eventHandler()
{
if ((this->flipflop = !this->flipflop))
this->button->setText("Panther");
else
this->button->setText("Pink");
}
private:
bool flipflop;
Wt::WPushButton *button;
};
Wt::WApplication *createApplication(const Wt::WEnvironment& env)
{
return new Application(env);
}
int main(int argc, char **argv)
{
return Wt::WRun(argc, argv, &createApplication);
}
Steps to Test:
- Enable WebSockets in the wt_config.xml file.
- Start the server listening on an IPv6 address.
- Load page in Firefox.
- Click the button.
Result:
Clicking the button doesn't do anything.
Expected Result:
The button's text toggles between "Pink" and "Panther."
Files
Updated by Kevin Robertson over 12 years ago
I filed this bug without being logged into redmine. I'm sticking this comment in here so that you can direct a question to me.
Updated by Wim Dumon over 12 years ago
Kevin,
Just made a little test: Chrome does switch to a WebSockets connection with an IPv6 Wt. FF doesn't even request to set up a websockets connection.
Before diving into this: this may be a bug in FF; do you know if FF can connect with other WebSockets implementations when using IPv6?
Wim.
Updated by Kevin Robertson over 12 years ago
The issue arises whenever the URI is built using location.hostname
. I don't know if the spec is clear on this and browsers implement it differently.
FF:
location.hostname = "::1"
Chrome:
location.hostname = "[::1]"
A cross-browser solution has to be formulated. location.host
will return [address]:port and can be used instead of catting the hostname and port separately. That needs tested on all of the supported browsers though.
References:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=11587
https://developer.mozilla.org/en/window.location
Updated by Koen Deforche almost 12 years ago
- Status changed from New to Resolved
- Assignee set to Koen Deforche
- Target version set to 3.3.0
Hey Kevin,
Thanks. location.host is indeed the better field in location !
Regards,
koen
Updated by Koen Deforche almost 12 years ago
- Status changed from Resolved to Closed