Hi all, we are building realtime application we use spring4 backend and
like to use dart in frontend. Spring4 support websockets through sock_js
and stomp. There are client dart libraries of both: sock-js-dart-client
(
) and stomp_dart (
https://github.com/rikulo/stomp). @Revalfire implement into stomp_dart implementation for allow connection stomp over sockjs hovewer it looks that today there are some problems.
https://github.com/rikulo/stomp/issues/11dart-js interoperability:So we decided to try to use javascript version for sock.js and stomp.js and use js-dart interoperability.
We
need from dart call some js methods for establishing sock_js
connection, sending data over stomp, and then call dart code from js
when there is some changes on backend.
Calling js code from dart is
running, we establish sock_js connection with server, call succesfully
method "sending" in js however there are some hard debug js errors in
the sending data to server:
stacktrace:
Instance of 'is'
STACKTRACE:
SockJS.prototype.send@
http://localhost:8080/build/sockjs-0.3.4.js:1173Client.prototype._transmit@
http://localhost:8080/build/stomp.js:114Client.prototype.send@
http://localhost:8080/build/stomp.js:276@
http://localhost:8080/build/app.js:33.l9.K9<@
http://localhost:8080/build/main.dart.js:17965...
our dart code:
var conn = new JsObject(context['Streaming']);
conn.callMethod('connect'); //same other
conn.callMethod('sending');
our js code:
var Streaming = function() {
var stompClient = null;
this.connect = function() {
var socket = new SockJS('/hello');
stompClient = Stomp.over(socket);
stompClient.connect('', '', function(frame) {
console.log('Connected: ' + frame);
stompClient.subscribe('/topic/greetings', function(greeting){
console.log("notification");
});});};
this.sending = function(){
console.log("I'm in sending");
stompClient.send("/app/hello", {}, JSON.stringify({ 'name': "hi dart" }));
}; };
Can you help us how to tackle that problem? Thanks a lot.