josephg / josephg/ShareJS

Connecting to sharejs 0.7.0

Open
#319 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5k
Forks
454
PR merge metrics
No merged PRs in 30d

Description

In version 0.6.3 it was possible to specify the server location of the sharejs server (ex: http://192.168.1.1:8000) like:

```

$(document).ready(function () {

var $textarea = $('#textarea');
var $textareaEditor = $('#textarea-editor');

var connection = sharejs.open('blag', 'text', 'http://192.168.1.1:8000/channel', function(error, doc) {
if (error) {
console.log(error);
} else {
$textarea.disabled = false;
doc.attach_textarea($textarea[0]);
}
});
});

```

I cannot figure out how to specify the url of the server in 0.7.0:

```
14
15 var elem = document.getElementById('pad');
16
17 var s = new BCSocket(null, {reconnect: true});
18
19 var sjs = new window.sharejs.Connection(s);
20
21 var doc = sjs.get('users', 'seph');
22 console.log(doc);
23 doc.subscribe();
24
25 doc.whenReady(function () {
26 if (!doc.type) doc.create('text');
27 if (doc.type && doc.type.name === 'text')
28 doc.attachTextarea(elem);
29 });
```

How can I specify the connection url like:

```
var s = new BCSocket('http://192.168.1.1:7007/channel', {reconnect: true});
```

or

```
var s = new BCSocket('http://192.168.1.1:7007/channel');
```

Neither of those worked.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.