Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3a761055
authored
Mar 09, 2016
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
PDB reconnects to room when socket regained
parent
900acc08
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
110 additions
and
5 deletions
sails/src/api/controllers/StudentController.js
sails/src/assets/app/modules/student/controllers/session.js
sails/src/assets/app/modules/student/controllers/student.js
sails/src/config/local.js~
sails/src/api/controllers/StudentController.js
View file @
3a761055
...
...
@@ -571,7 +571,7 @@ module.exports = {
return
res
.
json
(
500
,
{
error
:
'Not updated picto for student'
});
}
if
(
updated
)
{
console
.
log
(
"Updated attributes for picto student
"
);
console
.
log
(
"Updated attributes for picto student
:"
+
JSON
.
stringify
(
updated
[
0
])
);
return
res
.
json
(
updated
[
0
]);
}
});
...
...
@@ -800,13 +800,14 @@ module.exports = {
var
params
=
req
.
allParams
();
var
count
=
0
;
sails
.
log
.
debug
(
"
Inside actions_batch
"
);
sails
.
log
.
debug
(
"
Actions_batch request
"
);
if
(
!
params
.
actions
)
return
res
.
json
(
400
,
{
'error'
:
"no actions"
});
// We loop through the actions and store them in the database
async
.
forEach
(
params
.
actions
,
function
(
action
,
cb
){
sails
.
log
.
debug
(
"Actions batch is recording action: "
+
JSON
.
stringify
(
action
));
var
id_dev
=
null
;
if
(
action
.
attributes
.
id_dev
)
id_dev
=
action
.
attributes
.
id_dev
;
...
...
sails/src/assets/app/modules/student/controllers/session.js
View file @
3a761055
...
...
@@ -267,7 +267,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$scope
.
stop_ws
=
function
(){
// For view
$scope
.
sessionRunning
=
false
;
$scope
.
wsessions
[
$scope
.
wsessions
.
length
-
1
].
tries
.
pop
();
if
(
$scope
.
wsessions
.
length
>
0
)
$scope
.
wsessions
[
$scope
.
wsessions
.
length
-
1
].
tries
.
pop
();
$scope
.
ws
.
end
=
new
Date
();
$http
...
...
@@ -736,6 +736,9 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
//
// websockets events handling (Dashboard)
//
// Remove all listeners to this event
io
.
socket
.
off
(
'action'
);
...
...
sails/src/assets/app/modules/student/controllers/student.js
View file @
3a761055
...
...
@@ -247,10 +247,25 @@ dashboardControllers.controller('StudentCtrl', function StudentCtrl($scope, conf
//
// WebSockets communication
//
io
.
socket
.
on
(
'reconnect'
,
function
()
{
// Subscribe to student's socket room
console
.
log
(
"reconnecting to socket"
);
io
.
socket
.
post
(
'/stu/subscribe'
,
{
action
:
'subscribe'
,
attributes
:{
id_stu
:
$scope
.
studentData
.
id
},
token
:
$window
.
sessionStorage
.
token
},
function
(
res
)
{
console
.
log
(
"Connected to student: "
+
res
.
msg
);
});
});
/*
// Events handling
io.socket.on('action', function(data) {
console.log('"action" event received with the following data:');
console.log(data.msg);
});*/
});
\ No newline at end of file
});
sails/src/config/local.js~
0 → 100644
View file @
3a761055
//// template file for sails/src/config/local.js
/**
* Local environment settings
*
* Use this file to specify configuration settings for use while developing
* the app on your personal system: for example, this would be a good place
* to store database or email passwords that apply only to you, and shouldn't
* be shared with others in your organization.
*
* These settings take precedence over all other config files, including those
* in the env/ subfolder.
*
* PLEASE NOTE:
* local.js is included in your .gitignore, so if you're using git
* as a version control solution for your Sails app, keep in mind that
* this file won't be committed to your repository!
*
* Good news is, that means you can specify configuration for your local
* machine in this file without inadvertently committing personal information
* (like database passwords) to the repo. Plus, this prevents other members
* of your team from commiting their local configuration changes on top of yours.
*
* In a production environment, you probably want to leave this file out
* entirely and leave all your settings in env/production.js
*
*
* For more information, check out:
* http://sailsjs.org/#!/documentation/anatomy/myApp/config/local.js.html
*/
module.exports = {
/***************************************************************************
* Your SSL certificate and key, if you want to be able to serve HTTP *
* responses over https:// and/or use websockets over the wss:// protocol *
* (recommended for HTTP, strongly encouraged for WebSockets) *
* *
* In this example, we'll assume you created a folder in your project, *
* `config/ssl` and dumped your certificate/key files there: *
***************************************************************************/
ssl: {
ca: require('fs').readFileSync(__dirname + '/ssl/godaddy/gd.yottacode.com.bundle.crt'),
key: require('fs').readFileSync(__dirname + '/ssl/godaddy/gd.yottacode.com.key'),
cert: require('fs').readFileSync(__dirname + '/ssl/godaddy/gd.yottacode.com.crt')
},
/***************************************************************************
* The `port` setting determines which TCP port your app will be *
* deployed on. *
* *
* Ports are a transport-layer concept designed to allow many different *
* networking applications run at the same time on a single computer. *
* More about ports: *
* http://en.wikipedia.org/wiki/Port_(computer_networking) *
* *
* By default, if it's set, Sails uses the `PORT` environment variable. *
* Otherwise it falls back to port 1337. *
* *
* In env/production.js, you'll probably want to change this setting *
* to 80 (http://) or 443 (https://) if you have an SSL certificate *
***************************************************************************/
port: process.env.PORT || 1337,
/***************************************************************************
* The runtime "environment" of your Sails app is either typically *
* 'development' or 'production'. *
* *
* In development, your Sails app will go out of its way to help you *
* (for instance you will receive more descriptive error and *
* debugging output) *
* *
* In production, Sails configures itself (and its dependencies) to *
* optimize performance. You should always put your app in production mode *
* before you deploy it to a server. This helps ensure that your Sails *
* app remains stable, performant, and scalable. *
* *
* By default, Sails sets its environment using the `NODE_ENV` environment *
* variable. If NODE_ENV is not set, Sails will run in the *
* 'development' environment. *
***************************************************************************/
// environment: process.env.NODE_ENV || 'development'
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment