Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to rabbitmq - can't set virtual host #18

Open
ivan1986 opened this issue Mar 17, 2014 · 3 comments
Open

Unable to connect to rabbitmq - can't set virtual host #18

ivan1986 opened this issue Mar 17, 2014 · 3 comments

Comments

@ivan1986
Copy link

https://github.com/mobile-web-messaging/StompKit/blob/master/StompKit/StompKit.m#L348
Set virtual host same as host, but by default virtualhost is /
need add other option for virtualhost

@jmesnil
Copy link
Contributor

jmesnil commented Mar 17, 2014

you can pass it using the connectWithHeaders:completionHandler: method:

[self.client connectWithHeaders:@{@"virtualhost": @"/"}
              completionHandler:^(STOMPFrame *connectedFrame, NSError *error) {
                  ...
              }];

@Fess200
Copy link

Fess200 commented Mar 17, 2014

self.client = [[STOMPClient alloc] initWithHost:@"localhost" port:61613];

This return error -

[self.client connectWithHeaders:@{@"virtualhost": @"/",kHeaderLogin: @"guest", kHeaderPasscode: @"guest",kHeaderAcceptVersion:@"1.2", kHeaderHeartBeat: @"5000,10000",kHeaderHost:@"localhost"}
completionHandler:^(STOMPFrame *connectedFrame, NSError *error) {
...
}];

but if

[self.client connectWithHeaders:@{kHeaderLogin: @"guest", kHeaderPasscode: @"guest",kHeaderAcceptVersion:@"1.2", kHeaderHeartBeat: @"5000,10000",kHeaderHost:@"/"}
completionHandler:^(STOMPFrame *connectedFrame, NSError *error) {
...
}];

All is well

what am I doing wrong?

@jmesnil
Copy link
Contributor

jmesnil commented Mar 17, 2014

What is the error? What is RabbitMQ expecting to receive?

Have you read https://www.rabbitmq.com/stomp.html?

If a host header is specified it must be one of the virtual hosts known to the RabbitMQ server, otherwise the connection is rejected.

From what I understand, you don't need a virtualhost header at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants