I am using ngrok to tunnel to my ASP.NET core application. I am using Fleck to try and create a websocket connection between my application (server side) and an external API (client side). The problem is, the API requires a URL (ws://mysite.com/socket) that it will request a websocket connection from, however, the WebSocketServer(ip) object creates a websocket on a certain IP address and port. Can I tell the API to try and establish a connection with ws://5f1ce6fe.ngrok.io? Also, how do I find the IP address/port combination using ngrok that I will use to open the appropriate websocket on my server so that it accepts a websocket request at ws://5f1ce6fe.ngrok.io?
Thanks
Related
I have a web api that posts json to different external endpoints on certain conditions. We have a new client that wants us to open a web socket connection with them during an event, send them the data (json) when we get it via this socket, and close the socket after the event. I'm having a hard time figuring out the rails way to do this.
How do I open a web socket connection and keep it open? (basically where would the client sit/ what would the definition look like).
How do I send messages over the socket from a controller? (eg. after processing a post request send new data to this websocket)
How do I close the connection?
You can try using this gem called Faye. Here's an example for connecting and sending data: (note: I didn't test it)
# Open the connection
ws = Faye::WebSocket::Client.new('ws://www.example.com/')
# Send data to connection
ws.send(YOURJSONDATA)
# Close connection (RFC 6455)
ws.close
Notes for faye:
Using the WebSocket client
Adding headers and other options to connection
WebSocket API
RFC 6455
Hope it helps!
Does the Paho Java client has any callback function called when a new client connection is established? Within that function I want to validate user and if failed refuse connection.
When a new client connect from javascript or any client I should be able to allow or refuse new client.
This is not possible to do from a client, the MQTT protocol has no support for anything other than passing authentication information from a single client to the broker, not the other way round.
You have to do it from within the broker. Different brokers all implement authentication differently so it will depend entirely on which broker you are using.
Mosquitto has an API to write authentication plugins. e.g. https://github.com/jpmens/mosquitto-auth-plug
HiveMQ Also has an API http://www.hivemq.com/blog/mqtt-security-fundamentals-advanced-authentication-mechanisms
Mosca - https://github.com/mcollina/mosca/wiki/Authentication-&-Authorization
I'm trying to create a HTTP(s) proxy server that will act like this:
Browser configured to use proxy on 127.0.0.1:1080. On this port, I need to have a server (TIdTCPServer?) that will pass data coming to a client, that is connected on this same server (maybe into another port to make things easier). The client need to be connected, and not serving connection because of possible NAT restrictions.
The idea is that the client will execute the requests and send back to the server, which should send to the browser.
Browser > connect to local server > send to client connected which make the request
I thought about IdHTTPProxy, but no idea on how to pass request to a client, and client execute, gets back the data to the server / browser.
I read about TIdMappedPortTCP, but looks like this should connect into another host/port, and in my case the client can't receive connections.
If I have a link in an MVC application hosted on Azure:
Call web service
At the moment we are having difficulty connecting to the URL, which is a SOAP web service. We get an error 'site cannot be reached'.
Just to rule something out - what IP address would the service see this request coming from - my local (browser) or the server?
The request would come from your IP.
We have used Erlang/Cowboy to develop a simple chatting service based on WebSockets. Right now, We are using localhost:8080 to connect server.
I want to do user authentication, that will be done based on the URL parameter, and it will return user id or none for the connection.
How to do that?
Before the websocket exchange, you can ask a token to your application and use it with your websocket client.