support user to customize the path to socket-io server

This commit is contained in:
herbertc
2020-08-25 15:16:38 +08:00
parent ef714c3903
commit 8258997f3e

View File

@@ -13,6 +13,16 @@
@keyup.enter="urlValid ? toggleConnection() : null" @keyup.enter="urlValid ? toggleConnection() : null"
/> />
</li> </li>
<div>
<li>
<label for="socketio-path">{{ $t("path") }}</label>
<input
id="socketio-path"
spellcheck="false"
v-model="path"
/>
</li>
</div>
<div> <div>
<li> <li>
<label for="connect" class="hide-on-small-screen">&nbsp;</label> <label for="connect" class="hide-on-small-screen">&nbsp;</label>
@@ -28,7 +38,6 @@
</div> </div>
</ul> </ul>
</pw-section> </pw-section>
<pw-section class="purple" :label="$t('communication')" id="response" ref="response"> <pw-section class="purple" :label="$t('communication')" id="response" ref="response">
<ul> <ul>
<li> <li>
@@ -84,6 +93,7 @@ export default {
data() { data() {
return { return {
url: "ws://", url: "ws://",
path: "/socket.io",
connectionState: false, connectionState: false,
io: null, io: null,
communication: { communication: {
@@ -115,7 +125,12 @@ export default {
] ]
try { try {
this.io = new io(this.url) if(!this.path){
this.path = '/socket.io'
}
this.io = new io(this.url,{
path: this.path
})
// Add ability to listen to all events // Add ability to listen to all events
wildcard(io.Manager)(this.io) wildcard(io.Manager)(this.io)
this.io.on("connect", () => { this.io.on("connect", () => {