Skip to content

Commit d238bb9

Browse files
committed
Merge branch 'release/1.0.7'
2 parents f641812 + 2dbb9c3 commit d238bb9

File tree

5 files changed

+40
-3
lines changed

5 files changed

+40
-3
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
<a name="1.0.7"></a>
2+
## [1.0.7](https://github.com/adonisjs/adonis-websocket-client/compare/v1.0.6...v1.0.7) (2018-03-21)
3+
4+
5+
### Features
6+
7+
* **Connection:** auto detect url when not defined ([4f958e4](https://github.com/adonisjs/adonis-websocket-client/commit/4f958e4))
8+
9+
10+
111
<a name="1.0.6"></a>
212
## [1.0.6](https://github.com/adonisjs/adonis-websocket-client/compare/v1.0.5...v1.0.6) (2018-03-18)
313

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adonisjs/websocket-client",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"description": "Websocket client for AdonisJs",
55
"main": "dist/Ws.es.js",
66
"module": "dist/Ws.es.js",
@@ -31,6 +31,7 @@
3131
"babel-core": "^6.26.0",
3232
"babel-plugin-external-helpers": "^6.22.0",
3333
"babel-plugin-transform-object-assign": "^6.22.0",
34+
"babel-plugin-transform-regenerator": "^6.26.0",
3435
"babel-polyfill": "^6.26.0",
3536
"babel-preset-env": "^1.6.1",
3637
"chalk": "^2.3.2",

rollup.config.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@ const pkg = require('./package')
22
const basePlugins = require('./rollup.plugins.js')
33

44
const pluginBabel = require('rollup-plugin-babel')({
5+
ignore: /node_modules\/(!emittery).*/,
6+
plugins: ['external-helpers', 'transform-object-assign', 'transform-regenerator'],
7+
presets: [
8+
[
9+
'env',
10+
{
11+
modules: false,
12+
targets: {
13+
browsers: ['last 4 versions', 'safari >= 7', 'ie 11']
14+
}
15+
}
16+
]
17+
]
18+
})
19+
20+
const pluginBabelEs = require('rollup-plugin-babel')({
521
ignore: /node_modules\/(!emittery).*/,
622
plugins: ['external-helpers', 'transform-object-assign'],
723
presets: [
@@ -79,7 +95,7 @@ function esBuild () {
7995
file: pkg.module,
8096
format: 'es'
8197
},
82-
plugins: basePlugins.concat([pluginBabel])
98+
plugins: basePlugins.concat([pluginBabelEs])
8399
}
84100
}
85101

src/Connection/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ import debug from '../Debug/index.js'
1616
import Socket from '../Socket/index.js'
1717
import JsonEncoder from '../JsonEncoder/index.js'
1818

19+
/**
20+
* Returns the ws protocol based upon HTTP or HTTPS
21+
*
22+
* @returns {String}
23+
*
24+
*/
25+
const wsProtocol = window.location.protocol === 'https:' ? 'wss' : 'ws'
26+
1927
/**
2028
* Connection class is used to make a TCP/Socket connection
2129
* with the server. It relies on Native Websocket browser
@@ -30,6 +38,8 @@ export default class Connection extends Emitter {
3038
constructor (url, options) {
3139
super()
3240

41+
url = url ? url : `${wsProtocol}://${window.location.hostname}`
42+
3343
/**
3444
* Connection options
3545
*

0 commit comments

Comments
 (0)