Can any other javascript client library, apart from socjjs, be used with spring websocket - spring-websocket

Spring websocket implements SockJs protocol at server and sockjs client can be used to interact with it. Is there any other equivalant library which can be used? We need to send query string with the sockjs comet URL but it seems it is not supported
http://sockjs-tornado.readthedocs.org/en/latest/faq.html
https://twitter.com/majek04/status/376371451005128704
So, more precisely, is there an alternative to sockjs client which supports query string and the goodness of sockjs client -fallback options?
I have raised a question about support for query string in sockjs:
http://stackoverflow.com/questions/31118456/can-i-add-request-parameter-to-sockjs-constructor-so-that-it-can-be-send-to-serv

As the answer of your other question states, yes, this is supported in SocksJS 1.0.0.
And SockJS 1.0.0 will be the default version in Spring Framework 4.2.0.RELEASE, see SPR-12422.

Related

Solace Spring Cloud Stream Binder AMQP(S)

I would like to connect my Spring Boot application to a Solace PubSub+ instance using the following URL amqps://localhost:5671. I would like to use Spring Cloud Stream and Solace Spring Cloud Stream Binder for that.
I tried the following configuration in my application.yml:
solace:
java:
host: amqps://localhost:5671
clientUsername: admin
clientPassword: admin
But this does not work. I keep getting errors that amqps is not a valid scheme. Same goes for plain amqp:// URIs.
I have dug a little deeper into the code of Solace Spring Cloud Stream Binder, and I am not sure this is actually possible at all. It seems the configuration above only works for tcp:// and tcps:// URIs, both resulting in messages being sent over Solace's proprietary SMF protocol.
This works:
solace:
java:
host: tcp://localhost:55555
clientUsername: admin
clientPassword: admin
... but does not use AMQP but SMF.
How can I configure Solace Spring Cloud Stream Binder to communicate via AMQP and AMQPS?
The Spring Cloud Stream binders from Solace do not support AMQP. They are written using the Solace Java API JCSMP and use SMF, which you have observed.
I am not sure if there is a community SCS binder using AMQP 1.0. Is there a reason you need it to work in AMQP 1.0?

BreezeJS with .NET System.Services.Data.DataService OData Server: HTTP OPTIONS not supported for $metadata

I am trying to use BreezeJS with an existing OData server, that was implemented using .NET System.Services.Data.DataService, Version 4.0. As it seems, BreezeJS is doing a http OPTIONS request to get $metadata, but the server throws a NotImplemented exception.
When I manually request $metadata using http GET in the browser, I am getting (XML formatted) metadata fine.
Is there a way to configure Breeze to use http GET or would I need to somehow adjust the server to support http OPTIONS?
Any help would be appreciated.
The OPTIONS request is part of CORS, as explained in this answer. You need to configure your server to support CORS, or don't use cross-origin requests from the browser.
See this answer and this answer regarding using WCF with CORS. It seems the recommendation is to switch to Web API.

Web-service response is encoded using OWASP ESAPI,how to decode response Client side?

In my iOS application, i need to decode response which is encoded on server using OWASP ESAPI. web-service is written using java.
ESAPI means Enterprise Security API. This is a library which helps to avoid common security pitfalls.
It is not an "encoding" method per se, if you review its encoding suggestions you may work out the input behind.

Does Dart have support for the FTP protocol

Does Dart have any support for the FTP protocol. In particular code running on the server not the client.
thanks
Richard
https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:html.HttpRequest says
HttpRequest can be used to obtain data from HTTP and FTP protocols, and is useful for AJAX-style page updates.
I don't know if there is more necessary to get FTP support as you might want it.

Can a web browser use MQTT?

We are looking at using MQTT as the messaging protocol on a new device we're building. We'd also like a web interface for the device. Does anyone know if you can implement a browser client app (without additional plugins) that talks MQTT?
Yes, as mentioned in Steve-o's comment MQTT via websockets is very possible.
There are 2 options at the moment
IBM's MQ 7.5 comes with websockets support, you can find details here.
The Mosquitto broker has a javascript client with an example running here.
To answer your second question lighttpd has a websockets module that can be used to do forwarding to an existing broker with details here.
I've not been able to find anything for Apache that doesn't need you to write your own library to do the forwarding.
To extend hardillbs answer:
There is a third option now:
HiveMQ supports native websockets without the need for any external web server. It works perfectly with the Javascript client of Eclipse Paho.
If you want to try it out, the public MQTTDashboard (which uses HiveMQ under the hoods) supports websockets on port 8000.
Disclosure: I am one of the developers of HiveMQ
IBM has released a WebSockets based JavaScript client. It is open-source on Eclipse Paho.
Git repository:
http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.javascript.git/
Tutorial is here.
https://www.ibm.com/developerworks/community/blogs/c565c720-fe84-4f63-873f-607d87787327/entry/how_to_prog_javascript?lang=en
We've had good experience using WSS, the WebSocket to TCP Gateway (for MQTT). It means running a separate process, but that does avoid having to change Apache's configuration. WSS also has support for TLS.
Not Apache, but you can follow this guide to install lighttpd with mod_websocket,
http://oriolrius.cat/blog/2013/09/25/server-send-push-notifications-to-client-browser-without-polling/
but for easy of use I highly recommend HiveMQ, as #Dominik recommends.
The blog by jpmens is a good starting point to get mosquitto setup with websocket feature. He's client javascript code based on Paho is on github.
This blog "How to run your web server and MQTT WebSockets broker on the same por" explains two ways for the server side:
mosquitto with http configuration
apache+mod_websocket_mosquitto
Why not nodejs + socket.io? They come with all gadgets included (webscokets, pub/sub, webserver,mqtt broker...).
SocketCluster is another good starting point.
This link (Download codes) is useful. Download it and modify this file mosq-mqttws31.html. Instead of the embedded java script library use this cdn
https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.0.1/mqttws31.js
and the client instantiation should be client = new Paho.MQTT.Client("test.mosquitto.org", 8080,"myclien256tiddd_" + parseInt(Math.random() * 100, 10));

Resources