Skip to content

Commit

Permalink
Merge pull request #116 from getbraincloud/develop
Browse files Browse the repository at this point in the history
Release 4.4
  • Loading branch information
davidstl authored Feb 18, 2020
2 parents 65dd81c + ca0fefe commit 48d4c00
Show file tree
Hide file tree
Showing 12 changed files with 798 additions and 18 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,36 @@ If you haven't signed up or you want to log into the brainCloud portal, you can

https://portal.braincloudservers.com/

## Running in nodejs without web interface (nodejs server)

If you plan to run this server side in nodejs, it is possible. But it will fail to build at first because of missing web components. Simply put this into your main code file:
```javascript
// Set up XMLHttpRequest.
XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
window = {
XMLHttpRequest: XMLHttpRequest
};
XMLHttpRequest.UNSENT = 0;
XMLHttpRequest.OPENED = 1;
XMLHttpRequest.HEADERS_RECEIVED = 2;
XMLHttpRequest.LOADING = 3;
XMLHttpRequest.DONE = 4;
// Set up WebSocket.
WebSocket = require('ws');
// Set up LocalStorage.
LocalStorage = require('node-localstorage/LocalStorage').LocalStorage;
os = require('os');
var configDir = os.homedir() + "/.bciot";
localStorage = new LocalStorage(configDir);
const BC = require('braincloud');
```

And make sure to have the following NPM dependencies installed:
* braincloud
* node-localstorage
* ws
* xmlhttprequest

## Releases

Package | Description
Expand Down
29 changes: 29 additions & 0 deletions deploy/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,35 @@ console.log("Authenticating anonymously to brainCloud");
```
See https://github.com/react-native-community/react-native-async-storage for additional information on AsyncStorage.

## Running in nodejs without web interface (nodejs server)

If you plan to run this server side in nodejs, it is possible. But it will fail to build at first because of missing web components. Simply put this into your main code file:
```javascript
// Set up XMLHttpRequest.
XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
window = {
XMLHttpRequest: XMLHttpRequest
};
XMLHttpRequest.UNSENT = 0;
XMLHttpRequest.OPENED = 1;
XMLHttpRequest.HEADERS_RECEIVED = 2;
XMLHttpRequest.LOADING = 3;
XMLHttpRequest.DONE = 4;
// Set up WebSocket.
WebSocket = require('ws');
// Set up LocalStorage.
LocalStorage = require('node-localstorage/LocalStorage').LocalStorage;
os = require('os');
var configDir = os.homedir() + "/.bciot";
localStorage = new LocalStorage(configDir);
const BC = require('braincloud');
```

And make sure to have the following NPM dependencies installed:
* braincloud
* node-localstorage
* ws
* xmlhttprequest

## Implementation notes

Expand Down
12 changes: 6 additions & 6 deletions deploy/node/package-lock.json

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

4 changes: 2 additions & 2 deletions deploy/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
"xmlhttprequest": "^1.8.0"
},
"dependencies": {
"crypto-js": "^3.1.9-1",
"crypto-js": "^3.2.0",
"form-data": "^2.3.2",
"get-user-locale": "^1.1.1",
"get-user-locale": "^1.3.0",
"md5": "^2.2.1"
},
"homepage": "https://portal.braincloudservers.com",
Expand Down
3 changes: 3 additions & 0 deletions src/brainCloudBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ function BrainCloudManager ()
if(sessionId !== null || sessionId !== "")
{
bcm._isAuthenticated = true;
}
else
{
bcm._packetId = -1;
}
bcm._sessionId = sessionId;
Expand Down
Loading

0 comments on commit 48d4c00

Please sign in to comment.