MWSE/docs/readme.md

27 lines
586 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Kurulum
Proje ortamına kurulumu
```html
<script src="https://ws.saqut.com/script"></script>
```
Geliştirme ortamına kurulumu
```javascript
const wsjs = new MWSE({
endpoint: "https://ws.saqut.com/" // Bağlanılacak sunucuyu belirtir
});
wsjs.scope(async () => {
// Bağlantı sağlandığında burası tetiklenir
})
```
Kendi bağlantı kimliğini öğrenme
```
wsjs.scope(async () => {
let me = wsjs.peer('me'); // kendimizden bahsederken 'me' anahtar kelimesini kullanırız
console.log(me.socketId); // her peerin socketId'si olması gerekir
})
```