@symbo.ls/socket 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/client.js +9 -9
  2. package/package.json +1 -1
  3. package/server.js +3 -3
package/client.js CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  import io from 'socket.io-client'
4
4
 
5
- const url = 'ws://localhost:1001'
5
+ // const url = 'ws://localhost:1001'
6
+ // const url = 'ws://52.14.150.69:8080'
7
+ const url = 'ws://52.14.150.69:8080'
8
+ // const url = 'ws://ec2-52-14-150-69.us-east-2.compute.amazonaws.com:8080'
9
+ // const url = 'ws://socket.symbols.app'
6
10
  let socket
7
11
 
8
12
  export const connect = (key, receive) => {
@@ -21,14 +25,10 @@ export const connect = (key, receive) => {
21
25
  })
22
26
 
23
27
  socket.onAny((event, ...args) => {
24
- console.log(event, args[0])
25
- if (event === 'init') receive(event, args[0])
26
- else {
27
- try {
28
- receive(event, args[0])
29
- } catch (e) {
30
- console.error(e)
31
- }
28
+ try {
29
+ receive(event, args[0])
30
+ } catch (e) {
31
+ console.error(e)
32
32
  }
33
33
  })
34
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/socket",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "Connect your app to Symbols editor",
5
5
  "main": "server.js",
6
6
  "author": "symbo.ls",
package/server.js CHANGED
@@ -10,11 +10,11 @@ import mergeDeep from 'merge-deep' // use the require method
10
10
  import { createRequire } from 'module'
11
11
 
12
12
  const require = createRequire(import.meta.url) // construct the require method
13
- const DYNAMIC_CONFIG = require('@symbo.ls/init/src/dynamic.json') // Bring in the ability to create the 'require' method
13
+ const DES_SYS_DEFAULT_FILE = require('@symbo.ls/init/src/dynamic.json') // Bring in the ability to create the 'require' method
14
14
 
15
15
  const app = express()
16
16
 
17
- export const sync = (symbolsInitFile = DYNAMIC_CONFIG, options = {}) => {
17
+ export const sync = (desSysFile = DES_SYS_DEFAULT_FILE, options = {}) => {
18
18
  const server = http.createServer(app)
19
19
  console.log(options)
20
20
 
@@ -34,7 +34,7 @@ export const sync = (symbolsInitFile = DYNAMIC_CONFIG, options = {}) => {
34
34
 
35
35
  socket.join(options.key)
36
36
 
37
- socket.to(options.key).emit('init', symbolsInitFile)
37
+ socket.to(options.key).emit('init', desSysFile)
38
38
 
39
39
  socket.on('change', changes => {
40
40
  const file = require('@symbo.ls/init/src/dynamic.json')