Commit 3279cba9 authored by ioedeveloper's avatar ioedeveloper

Connect websocket client to server

parent a9a97104
......@@ -143,18 +143,17 @@ class App {
registry.put({api: config, name: 'config'})
// load file system
self.appManager = new RemixAppManager({})
self._components.filesProviders = {}
self._components.filesProviders['browser'] = new FileProvider('browser')
registry.put({api: self._components.filesProviders['browser'], name: 'fileproviders/browser'})
// var remixd = new Remixd(65520)
// registry.put({api: remixd, name: 'remixd'})
// remixd.event.register('system', (message) => {
// if (message.error) toolTip(message.error)
// })
var remixd = new Remixd(65520)
registry.put({api: remixd, name: 'remixd'})
remixd.event.register('system', (message) => {
if (message.error) toolTip(message.error)
})
self._components.filesProviders['localhost'] = new RemixDProvider(self.appManager)
self._components.filesProviders['localhost'] = new RemixDProvider(remixd, self.appManager)
registry.put({api: self._components.filesProviders['localhost'], name: 'fileproviders/localhost'})
registry.put({api: self._components.filesProviders, name: 'fileproviders'})
......
......@@ -17,9 +17,9 @@ module.exports = class RemixDProvider {
var remixdEvents = ['connecting', 'connected', 'errored', 'closed']
remixdEvents.forEach((value) => {
// remixd.event.register(value, (event) => {
// this.event.trigger(value, [event])
// })
remixd.event.register(value, (event) => {
this.event.trigger(value, [event])
})
})
// remixd.event.register('notified', (data) => {
......@@ -69,7 +69,7 @@ module.exports = class RemixDProvider {
})
}
// @TODO: refactor all `this._appManager.call(....)` uses into `this.remixd[api](...)`
// @TODO: refactor all `this._remixd.call(....)` uses into `this.remixd[api](...)`
// where `api = ...`:
// this.remixd.read(path, (error, content) => {})
// this.remixd.write(path, content, (error, result) => {})
......@@ -182,7 +182,7 @@ module.exports = class RemixDProvider {
const unprefixedpath = this.removePrefix(path)
const callId = await this._appManager.call('remixd', 'isDirectory', {path: unprefixedpath})
return await this._appManager.receiveResponse(callId)
return await this._remixd.receiveResponse(callId)
}
async isFile (path) {
......@@ -192,7 +192,7 @@ module.exports = class RemixDProvider {
}
}
function remixapi (appManager, self) {
function remixapi (remixd, self) {
const read = (path, callback) => {
path = '' + (path || '')
path = pathtool.join('./', path)
......
......@@ -21,7 +21,7 @@ var css = csjs`
const profile = {
name: 'remixd',
url: 'ws://127.0.0.1:65520',
methods: ['folderIsReadOnly', 'resolveDirectory', 'get', 'exists', 'isFile'],
methods: ['folderIsReadOnly'],
events: [],
description: 'Using Remixd daemon, allow to access file system',
kind: 'other',
......@@ -43,7 +43,8 @@ export class RemixdHandle extends WebsocketPlugin {
})
}
activate () {
async activate () {
await super.activate()
this.connectToLocalhost()
}
......
......@@ -106,6 +106,7 @@ class Remixd {
reject(error)
return
}
console.log('this.socket: ', this.socket)
if (this.socket && this.socket.readyState === this.socket.OPEN) {
var data = this.format(service, fn, args)
this.callbacks[data.id] = callback
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment