any ideas on how to intercept WebSocket requests from CefSharp?
I used the solution described in the following link, but Create method never get fired
Using CefSharp's ResourceHandlerFactory with SignalR/WebSockets
could someone help me with this?
Related
I am hoping someone can point me in the right direction. I have a CF2021 Server which uses a Node.js websocket server and CF pages (via javascript) as a client. Messages from user to user work as expected, so no issue there.
This CF Server also has a custom API built using CFML that handles and routes inbound SMS messages. My question is; what would be the best way to send the SMS message (by now its json) to the Node.js websocket to it can send it to the user(s).
I tried using the same javascript that the browser client uses, but it appears that the CFML API script is "browser-less", so that doesn't work, or should it?
I thought something like Apache Groovy may be the solution, but I am having difficulties with any websocket example I have found.
Any suggestions would be greatly appreciated.
thanks in advance
Flow matters.
If you want to handle an incoming message by delivering it to all currently logged in users who are subscribed to messages of the current sort: set up your message handler to deliver using lucee/adobe-coldfusion websockets. Be forewarned, Lucee takes some setup time, but once running, it is a great solution.
If you don't need immediate delivery, or you need a super simple solution: I actually have had some success with "Long Polling" you just have to remember to use "flush" early in the request, before any pause/sleep, then loop your message lookup requests for new data, with a 1-5 second delay between each loop. Once new data is found, I like to return the request to the client, close that polling request and start a new polling request using the client side. I typically won't poll for more than 60 seconds. Even if the returned json object is empty.
I am working on an API application on Rails 4.2.0. Wonder if there any way I could tell if the client closes the connection after they made API call to the server.
Tried session and cookie, seems they do not design for it.
Every HTTP requests ends up being closed when it's complete, as that's how the HTTP request-response cycle works. It's extremely rare to have connections hanging open as long-polling fell out of style once WebSocket was standardized.
After the client has made a call you can assume that request has completed and they've disconnected. There's no way of knowing if they will make additional requests or not, it's entirely up to the client.
In response to your comment on what you are actually trying to do, the only way I can think of would be via javascript using onunload. Here is a very basic example.
<body onunload="handleOnClose()">
<script>
function handleOnClose()
{
// send something to your backend
}
</script>
</body>
For more info see this SO question
I have been trying this for quite some time and with no avail. Would someone point me to the right direction.
I have a simple suitelet
the suitelet dumps a html in the response by reading a file
The html has a button. On ajax call of that button, a restlet gets called and a request is sent.
This is working great with Login and internal calls. However, I want the suitelet to be available without login and also the restlet.
When I do that, I get CORS error and using jsonp when I relsolve that, I get 401 Unauthorized
Tried Outh and NLAuth, no avail.
Will really appreciate any help or pointers.
If the info isn't sensitive you can call the suitelet from the domain of your website. If you have enabled https on the site then that'll just work
e.g. https://forms.na3.netsuite.com/app/site... becomes http://example.com/app/site...
If you are using SCA then you can also just do this by calling a .ss service function. The nice thing about that is that you can set the role on the .ss file and have better control of your resources without just making the customer center role capable of seeing everything. Same issue with https though.
If the info is sensitive you can get around the issue on most browsers by embedding an iframe at the https:// forms etc and using the onMessage operation to transfer info from the non-secure to the secure. (see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage)
It's certainly possible to call a RESTlet from a Suitelet but it sounds like your issue is more how to call the Suitelet securely.
I am using atmosphere jersey with redis broadcaster.
When I keep enableProtocol:true in javascript, the first subscribe request is successful.
But when I send next subscribe request I get Continuation Frame warning. I tested on Google chrome. I have attached the snapshot.
What could the issue be?
It works when I keep enableProtocol:false. But then onDisconnect is not called in long-polling.
After some observation I found that the X-Atmosphere-tracking-id=0 in first request and in subsequent requests I get it as the tracking id of previous request.
How do I avoid this?
You can try by manually setting the tracking-id to 0 before each subscribe.
$.atmosphere.uuid = 0
I am having problems calling a web service using AJAX via HTTP when it's on an HTTPS page.
Is this a cross-domain/protocol problem? Do I need to do the AJAX call in the same protocol as the page?
Just wondering if it's the same problem as trying to do an HTTPS AJAX call when on an HTTP page, I suspect it is.
Any advice appreciated.
Thanks
Duncan
Yes, the protocol is part of the same origin policy.
Don't do that. You run a serious risk of someone intercepting and modifying just the HTTP traffic to break your security.