You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Laravel 8 and trying to integrate Thruway. Below is the code copied from SimpleWSRouter.php and added in my src.
$port = 6001;
$router = new Router();
$transportProvider = new RatchetTransportProvider("127.0.0.1", $port);
$router->addTransportProvider($transportProvider);
$router->start();
autobahn
var connection = new autobahn.Connection({
url: 'ws://localhost:6001',
realm: 'realm1'
});
connection.onopen = function(session) {
// 1) subscribe to a topic
function onevent(args) {
console.log("Event:", args[0]);
}
session.subscribe('com.myapp.hello', onevent);
// 2) publish an event
session.publish('com.myapp.hello', ['Hello, world!']);
// 3) register a procedure for remoting
function procedureRegister(args) {
return args[0] + " " + args[1];
}
session.register('com.myapp.pr1', procedureRegister);
// 4) call a remote procedure
session.call('com.myapp.pr1', ["FNAME", "LNAME"]).then(
function(res) {
console.log("Result:", res);
}
);
};
connection.open();
I can connect without problem but I dont know what to do next after this.
What I know:
session.subscribe: subscribe to a channel (in this case channel name is "com.myapp.hello")
session.publish: Probably used to send message from user to user using the channel name.
What I dont know:
session.register and session.call. I also dont know where should I add realm in my server to connect the code. I think realm1 is default realm.
I actually came from ratchet. with ratchet, I can register a websocket server to work on open, close, message, etc. However Ratchet and Autobahn is not compatible ( with wampv1 and 2) etc.
Any help would be appreciated.
The text was updated successfully, but these errors were encountered:
I am using Laravel 8 and trying to integrate Thruway. Below is the code copied from SimpleWSRouter.php and added in my src.
autobahn
I can connect without problem but I dont know what to do next after this.
What I know:
session.subscribe: subscribe to a channel (in this case channel name is "com.myapp.hello")
session.publish: Probably used to send message from user to user using the channel name.
What I dont know:
session.register and session.call. I also dont know where should I add realm in my server to connect the code. I think realm1 is default realm.
I actually came from ratchet. with ratchet, I can register a websocket server to work on open, close, message, etc. However Ratchet and Autobahn is not compatible ( with wampv1 and 2) etc.
Any help would be appreciated.
The text was updated successfully, but these errors were encountered: