Skip to content

Commit

Permalink
version up
Browse files Browse the repository at this point in the history
  • Loading branch information
kalmyk committed Feb 7, 2020
1 parent 47b1a7a commit 2bb0735
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,20 @@ const FoxRouter = require('fox-wamp')
const PORT = process.env.PORT || 5000

let app = express()
app.get('/', (req, res) => res.send('Hello World!'))

let httpServer = http.createServer(app)
httpServer.listen(PORT, () => console.log(`Listening on ${ PORT }`))

router = new FoxRouter()
router.listenWAMP({server: httpServer, path: "/wss"})
router.listenWAMP({server: httpServer, path: "/wamp"})
```

and correspondingly the web socket client connection will look like as
```javascript
let autobahn = require('autobahn')
let connection = new autobahn.Connection({
url: 'ws:localhost:5000/wss',
url: 'ws:localhost:5000/wamp',
realm: 'realm1'
})
```
Expand Down
16 changes: 7 additions & 9 deletions bin/with_auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
// This is authenticate router example
//

var Router = require('../index')
var TopicPattern = require('../lib/topic_pattern')
var program = require('commander')
const Router = require('../index')
const TopicPattern = require('../lib/topic_pattern')
const program = require('commander')

program
.option('-p, --port <port>', 'Server IP port', 9000)
.parse(process.argv)

let app = new Router()
const app = new Router()
app.setLogTrace(true)

let WampAuth = function () {
const WampAuth = function () {
this.getAuthMethods = function () {
return ['ticket']
}
Expand Down Expand Up @@ -42,15 +42,13 @@ let WampAuth = function () {
}
this.wampcra_auth = function (realmName, secureDetails, secret, extra, cb) {
console.log(realmName, secureDetails, secret, extra)

}
this.authorize = function (session, funcClass, uniUri) {
let userDetails = session.getUserDetails()
const userDetails = session.getUserDetails()
console.log('authorize:', funcClass, uniUri, 'userDetails:', userDetails)
if (userDetails.role === 'admin') {
return true
}
else {
} else {
return !TopicPattern.intersect(uniUri, ['sys', 'user', 'info', '#'])
}
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fox-wamp",
"version": "0.6.9",
"version": "0.7.0",
"description": "Web Application Message Router/Server WAMP/MQTT",
"author": {
"name": "Anatoly Tsapkov",
Expand Down

0 comments on commit 2bb0735

Please sign in to comment.