SocketStream を使い始めたばかりです。(v0.1.0) exports.actions.login 関数を使用してファイル /app/server/auth.coffee を作成しました。このファイルの @session.setUserId にアクセスしたいのですが、@session がどこにあり、/app/server/app.coffee の外でアクセスする方法を理解するのに苦労しています。
これは、セッションにアクセスしたいコメント付きの auth.coffee です。
users = [
username: 'craig'
password: 'craig',
username: 'joe'
password: 'joe',
]
authenticate = (credentials, cb) ->
user = _.detect users, (user) ->
user.username == credentials.username and user.password == credentials.password
authenticated = true if user?
callback cb, authenticated
exports.actions =
login: (credentials, cb) ->
authenticate credentials, (user) ->
# here is where i'd like to set the userId like so:
# @session.setUserId credentials.username
callback cb user