JS webstomp BAD CONNECT Access refused for user 'guest' - javascript

I have problem with connection to RabbitMQ server (version: 3.8.2, erlang version: 22.2.8) by JS (on browser) webstomp. I'm using stomp.js.
I'm using example from here: https://github.com/rabbitmq/rabbitmq-web-stomp-examples/blob/master/priv/echo.html
I've done everything like is described here: https://www.rabbitmq.com/web-stomp.html
I've set permissions to my user using this: sudo rabbitmqctl set_permissions -p / user ".*" ".*" ".*"
I've set tags to my user using this: sudo rabbitmqctl set_user_tags user management
I've already checked these solutions:
Failing to connect RabbitMQ through a EasyNetQ, getting access refused for user guest and
RabbitMQ - access to vhost 'XXX' refused for user 'guest',
and others that I found in google.
My configuration for rabbitmq_web_stomp:
{rabbitmq_web_stomp,
[
{tcp_config, [{port, 15674}
]
},
{use_http_auth, true},
{ssl_config, [{port, 15673},
{backlog, 1024},
{cacertfile,"path/to/cert"},
{certfile,"path/to/cert"},
{keyfile,"path/to/cert"},
{password, "pass"}
]
}
]
},
I always get the same response from server:
Opening Web Socket...
Web Socket Opened...
>>> CONNECT login:user passcode:pass host:/ accept-version:1.1,1.0 heart-beat:10000,10000
<<< ERROR message:Bad CONNECT content-type:text/plain version:1.0,1.1,1.2 content-length:32 Access refused for user 'guest'
Whoops! Lost connection to ws://ip.addres/ws
I have access (for this user) to the server by .NET Core client in C# and by Management Plugin
Thanks for help!

I found the solution.
I don't exactly sure why it works but it was enough to remove the {use_http_auth, true} from configuration. After that there was no problem with connection from JS from browser.

Related

WebSocket connection timed out in EC2 website

I have a problem that seems to me to be impossible to solve, well, I have a website on EC2, I bought my own domain, I added HTTPS using Let's encrypt, and on this website there is a chat, and I am using the PHP Ratchet library to create a connection with websockets, and the problem is that my server doesn't start in the browser, well, I've tried to make my server start with several ports, 3000, 8080, 8181, 8443, 4433, and none of these work, at least when I use the command php chat-server.php to start the PHP server, I don't get any errors, it works, however, when entering the browser, it doesn't display a message in the PHP script console saying that there is a new connection, and the browser console ( chrome) reports a timed out error, that is, it looks like you are not connecting to the server, I really don't know what to do anymore, I don't know if this is because of the HTTPS I'm using, I don't know if should I edit something in the apache configuration, I need the someone help me, please
In fact, I already edited the security group in EC2, I already enabled these ports that I said I tried to use, I restarted the Apache server too and I still get the same error
PHP CODE - chat-server.php :
<?php
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use Local\Socket\Chat;
require dirname(__DIR__) . '/vendor/autoload.php';
$server = IoServer::factory(
new HttpServer(
new WsServer(
new Chat()
)
),
4433
);
$server->run();
JS CODE:
var conn = new WebSocket("wss://example.net:4433/chat.php");
ERROR:
failed: Error in connection establishment:
net::ERR_CONNECTION_TIMED_OU

shopify store won't run the code in script tag, error generated

I have installed a script tag in my shopify store. It is supposed to run when I load my store, when I look in my network panel, I can see that it was loaded but it failed. when I look under the console, it generated an error
net::ERR_CONNECTION_REFUSED. why is my store refusing to run my code?
post data looks like this
var postdata = {
"script_tag":{
"event":"onload",
"display_scope":"online_store",
"src":"https://localhost:3000/testscript.js"
}
}
There are a variety of reasons why your script tag could not be working. A few solutions are listed below:
1) Your URI should begin with "http://" (without the "s") seeing as this is a localhost server.
2) Try unchecking proxy server for your lan 127.0.0.1 through internet properties (how to locate this depends on your platform).
3) Port 3000 could already be in use, so try using something else like the widely-known 8080 or 1337. See here for more information on killing a Port 300 in use.

Open sessionURL for Autobahn websocket in browser

I have a Pyramid web application on which I would like to embed an iFrame displaying an instance of ParaViewWeb's visualizer so users can display VTU files remotely.
I have successfully done so while running the application on my own workstation by calling a subprocess from Python that executes ParaViewWeb's Quick Start method and returns the URL to JavaScript for iFrame generation.
http://www.paraview.org/ParaView3/Doc/Nightly/www/js-doc/index.html#!/guide/quick_start
However, in order to accommodate multiple users, ParaViewWeb's documentation indicates that
the server must provide a single entry point to establish a connection, as well as a mechanism to start a new visualization session on demand
for which it suggests using Apache as the front-end application and a python launcher to start the process for each session.
Conveniently, I have a "freshly installed Ubuntu Desktop 14.04 LTS" so I used the following guide to configure both the launcher and Apache:
http://www.paraview.org/ParaView3/Doc/Nightly/www/js-doc/index.html#!/guide/ubuntu_14_04
Ok so I'm pretty sure I am missing something major here, but once the launcher is started with /data/pvw/bin/start.sh... how do I then submit the request with information regarding what app to use (visualizer) and what data directory to load???
Update
I am able to launch a session such that a sessionURL with a unique ID is returned by first running
/data/pvw/bin$ ./start.sh
and then entering the following commands in the python interpreter
>>> import requests
>>> import json
>>> data = {"sessionManagerURL": "http://localhost:8080/paraview", "application": "visualizer"}
>>> data = json.dumps(data)
>>> r = requests.post("http://localhost:8080/paraview",data=data)
>>> r.json()['sessionURL']
u'ws://localhost/proxy?sessionId=e2970d68-42c8-11e5-a755-3c970e8061f9'
So now I have a websocket which should contain an instance of ParaViewWeb that I would like to access from the browser... typing the sessionURL as is into the browser does nothing and replacing 'ws' with 'http' opens a page with the following text:
AutobahnPython 0.6.0
I am not Web server, but a WebSocket endpoint. You can talk to me using the WebSocket protocol.
For more information, please visit my homepage.
I am new to both apache and websockets so I am reading up on the protocol on the homepage, but if someone has a quick answer about how to utilize this websocket to display ParaViewWeb to the user I would be very appreciative!!
Note: Command line argument -dr is unknown so omit it from all of the command line arguments given in the guide's launcher.json
Thanks in advance!

Can socket.io work across domains?

I have a socket.io implementation, and I'm trying to make it work across domains but it appears it can't. Here's my exact use case:
I have a node.js server running socket.io.
I have a JS / HTML5 game that I want to be able to host from anywhere, which has the client socket.io code and tries to connect to the server.
I have the same JS code running on mobile devices via SpiderMonkey (this is one of the main reasons I need to run this from any domain).
I find that I simply cannot connect to the socket unless I am serving the JS code from my node.js server to a browser. If I simply open the HTML file on my disk from my browser, for example, it will not work.
Server code:
io.on( "connection", function( socket )
{
this.socket = socket;
this.socket.on( "echo", function( str ){ this.socket.emit( "message", str ); }.bind( this ) );
}.bind( this ) );
Client code:
this.socket = io.connect( ip );
this.socket.on("message", function( str ) { console.log( str ); } );
And I can't even connect, I get my print out that it's trying to connect, but it never succeeds and then starts throwing ping errors. So, is this even possible? Or must I do it with long polling or something?
The error:
[Error] Failed to load resource: A server with the specified hostname could not be found. (socket.io, line 0)
EXTRA INFO:
This specifically will not work if I am trying to connect from an HTML file opened from disk using file:///. I am going to try across different machines on the same network...
Yes, Socket.IO works cross-domain just fine. The actual Socket.IO library can/should be loaded from the server hosting it.
EXTRA INFO: This specifically will not work if I am trying to connect from an HTML file opened from disk using file:///.
Don't do that. You run into all sorts of weird issues when loading files off disk vs. over HTTP.
Failed to load resource: A server with the specified hostname could not be found.
This usually implies that whatever hostname you're trying to connect to isn't resolvable, indicating a DNS problem or that you typoed your hostname. In any case, your code example doesn't show the relevant part where the problem may be. Use your browser's developer tools to first determine that everything is loading correctly. Then, verify the address of what you're trying to connect to.

facebook chat using strophe, punjab

using the answer of my previous question and another post I tried to implement facebook-chat from a browser. Here is what I did:
on an ubuntu virtual machine, I have python 2.6.5, python-twisted-conch 1:10.0.0-2, python-twisted-names 10.0.0-1, python-twisted-web 10.0.0-1 and python-twisted-words 10.0.0-2 already installed. I did not install jabberd2 server, I assumed facebook server is the Jabber/XMPP server in my case. Also I did not install pyopenssl.
downloaded and untared punjab from here
run it using the following command
user#ubunto: sudo twistd punjab
sometimes it tells that the process is already running under PID xxx but most times the reply was
Removing stale pidfile /home/user/twistd.pid
Does this mean that punjab is running?
In the punjab.tac file, according to this post I change the root.putChild line to
root.putChild('bosh', b)
On the other hand, I have an apache server running on the host computer (windows xp) to host my webpage that uses Strophe. In the apache config file httpd.conf, I proxy the BOSH requests to punjab at port 5280 using:
<IfModule proxy_http_module>
ProxyRequests Off
ProxyPass /bosh http://ubunto_ipAddress:5280/bosh
ProxyPassReverse /bosh http://ubunto_ipAddress:5280/bosh
</IfModule>
Note that the host and the virtual machine are bridged, so both get their IP address from the router and each one can ping the other. I also didn't install a jabber/xmpp server, or
For testing, I use the basic example of strophe as my webpage basic.html and basic.js with JID: FB_username#chat.facebook.com & password: FB_password.
I get the following:
Strophe is connecting.
SENT: <body rid='1709425072' xmlns='http://jabber.org/protocol/httpbind' to='chat.facebook.com' xml:lang='en' wait='60' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/>
Strophe is disconnecting.
Is there anything wrong or missing? Please help since I am not finding real documentation other than some posts concerning this issue. Thanks
Sabah
I'm not certain this is what you're trying to do, but if you're trying to have a webpage independently connect to Facebook Chat via JS, it's not going to work due to Cross Site Scripting protections. You can only use Strophe to connect to the same server that issued the webpage Strophe is working on. You'll have to connect back to your server first and use that as an inbetween; or use iframes to embed facebook chat in your webpage.
(For the record, I know nothing about Python, but it looks like your problem is with the JS :) )

Categories

Resources