swagchat is an open source chat components for your webapps.
This is SDK for Chat API
Currently developing for version 1
<script src="https://unpkg.com/swagchat-sdk/dist/swagchat-sdk.min.js"></script>
npm install --save swagchat-sdk
Please use TypeScript for development, but you do not need to install @types/swagchat-sdk
.
Type definitions are included in this repository.
<script src="https://unpkg.com/swagchat-sdk/dist/swagchat-sdk.min.js"></script>
<script >
// Initialize client.
var sc = new SwagChat.Client({
apiKey: "API_KEY",
apiSecret: "API_SECRET",
apiEndpoint: "http://localhost:9000/v0",
realtime: {
endpoint: "ws://localhost:9100/v0"
}
});
// Create user.
sc.createUser({
name: "USER_NAME",
}).then(function(res) {
if (res.error) {
console.log(res.error);
} else {
console.log(res.user);
}
})
</script>
import { Client } from "swagchat-sdk";
// Initialize client.
const sc = new Client({
apiKey: "API_KEY",
apiSecret: "API_SECRET",
apiEndpoint: "http://localhost:9000/v0",
realtime: {
endpoint: "ws://localhost:9100/v0"
}
});
// Create user.
sc.createUser({
name: "USER_NAME",
}).then(function(res) {
if (res.error) {
console.log(res.error);
} else {
console.log(res.user);
}
})
Open doc/index.html
in browser.
Generated using TypeDoc
MIT License.