benshepherd icon

Untitled

benshepherd | PRO | 08/21/18 11:35:21 PM UTC | 0 ⭐ | 10090 👁️ | Never ⏰ | []
ECMAScript |

540 B

|

None

|

0 👍

/

0 👎

import React, { Component } from 'react'
let io = require('socket.io-client')
 
class Server  {
    constructor() {
        this.socket = null
        this.host = 'http://localhost'
        this.port = 5001        
    }
 
    connect = () => {
        return new Promise(resolve => {
            this.socket = io(this.host+':'+this.port)
            this.socket.on('connect', () => {
                resolve()
            })
        })
        
    }
 
    socket() {
        return this.socket
    }
}
 
export default Server

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎