daily pastebin goal
38%
SHARE
TWEET

Untitled

benshepherd Aug 21st, 2018 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react'
  2. let io = require('socket.io-client')
  3.  
  4. class Server  {
  5.     constructor() {
  6.         this.socket = null
  7.         this.host = 'http://localhost'
  8.         this.port = 5001        
  9.     }
  10.  
  11.     connect = () => {
  12.         return new Promise(resolve => {
  13.             this.socket = io(this.host+':'+this.port)
  14.             this.socket.on('connect', () => {
  15.                 resolve()
  16.             })
  17.         })
  18.        
  19.     }
  20.  
  21.     socket() {
  22.         return this.socket
  23.     }
  24. }
  25.  
  26. export default Server
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top