New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
controller.req.data.post is undefined and websocket authorization #203
Comments
Hi @KiPSOFT, Thanks. |
But remained:
|
Thanks for quick response peter. How to read this change list ? because controller.framework.config return undefined. i'm changed to controller.config worked. What do you think about a websocket authorization problem ? |
Yes, I normalized names because older version framework has many unnecessary links. So I don't know about the problem of websocket authorization. Can you describe it? |
My source structure; definitions/authorization.js framework.once('load', function() {
var self = this;
var auth = self.module('auth');
auth.onAuthorization = function(id, callback) {
var user = {};
if (id == 1) {
user.id = 1;
user.kulAdi = "admin";
user.sifre = "123";
callback(user);
}
else
callback(false);
};
auth.options.expireSession = 480;
auth.options.expireCookie = 10;
}); controllers/ws.js exports.install = function (framework) {
framework.route('/sshvac', view_homepage);
framework.websocket('/', sshwebsocket, ['json'], ['ssh'], ['*']);
}
function view_homepage() {
var self = this;
self.layout("");
self.view('sshvac');
}
function sshwebsocket() {
} controllers/default.js exports.install = function (framework) {
framework.route('/', view_homepage, ['authorize']);
framework.route('/', loginOlmadan);
};
function view_homepage() {
var self = this;
self.view('homepage');
}
function loginOlmadan() {
var self = this;
self.layout("");
self.view('loginolmadan');
} views/sshvac.html <!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Deneme</title>
@{js('term.js/term.js')}
</head>
<body style="background-color: black">
<div id="term">
</div>
<script>
var socket = null;
socket = new WebSocket('ws://127.0.0.1:8029/', 'ssh');
</script>
</body>
</html> i'm request "http://127.0.0.1:8029/sshvac"
Thanks. |
Problem is in |
I downloaded new auth module and same error. https://github.com/totaljs/modules/blob/master/auth/v1.00/auth.js |
And what version of total.js do you use? |
my total.js version v1.6.1 |
Hmmm on v1.6.1 it works. |
Problem only websocket request. |
Aha ... Do you have some example? I'll fix it. Thanks |
I have example but so complex. |
OK I understand. Tomorrow I'll create an own example and I'll test it. |
Thanks peter. |
Hi @KiPSOFT, Please download latest version from GitHub and try to test it. The problem was not in |
Hi peter; I'm download latest version from github and test again. i'm getting same error.i'm prepare simple example. Please check this example how's wrong. https://github.com/KiPSOFT/totaljswstest Thanks. |
Thanks, I found a problem in the framework 👎. I fixed it on GitHub, please download the latest version. Else ... You forgot to add a Give me a feedback. |
Great working. Thanks peter. |
Sorry for bugs 💯 |
I'm looking for a working example for auth over websockets. Is there some example I'm missing? I tried hard to figure it out with the auth module, but I only managed to get auth working for regular routes, not websockets. i would really appreciate if you could help me out. |
Hi @dpoellath, If you will have a problem, contact me. I'll write you a simple example. |
Hi, But I'm sure I oversee something. Perhaps you can add a example. |
Please try to read this blog (try to understand without Again: If you will have a problem, contact me. I'll write you a simple example. |
Hi peter;
I'm using version 1.5 and use controller.req.data.post but last version getting this error;
default ---> TypeError: Cannot read property 'post' of undefined ([object Object]) TypeError: Cannot read property 'post' of undefined
second problem:
i'm using authorization module and websocket request. i'm getting error in websocket request.
ReferenceError: req is not defined ReferenceError: req is not defined at WebSocketClient.protocol (/var/www/vw_kodlar/client/generator_web/node_modules/total.js/index.js:5:31885) at WebSocketClient.prepare (/var/www/vw_kodlar/client/generator_web/node_modules/total.js/index.js:6:914) at EventEmitter.Framework._upgrade_continue (/var/www/vw_kodlar/client/generator_web/node_modules/total.js/index.js:3:951) at /var/www/vw_kodlar/client/generator_web/node_modules/total.js/index.js:3:809 at EventEmitter.Users._onAuthorization (/var/www/vw_kodlar/client/generator_web/modules/authorization.js:22:588) at EventEmitter.framework.onAuthorization (/var/www/vw_kodlar/client/generator_web/modules/authorization.js:22:3788) at EventEmitter.Framework._upgrade_prepare (/var/www/vw_kodlar/client/generator_web/node_modules/total.js/index.js:3:540) at EventEmitter.Framework._upgrade (/var/www/vw_kodlar/client/generator_web/node_modules/total.js/index.js:2:31827) at Server. (/var/www/vw_kodlar/client/generator_web/node_modules/total.js/index.js:2:21383) at Server.EventEmitter.emit (events.js:106:17)
Problems occurred when updating to the latest version, a little bit about backwards compatibility problems.
Thanks.
The text was updated successfully, but these errors were encountered: