const {ccclass, property} = cc._decorator;
import {connect} from './socket.io.1.4.8';

@ccclass
export default class Helloworld extends cc.Component {

    @property(cc.Label)
    label: cc.Label = null;

    start () {
        let self = this;
        var socket = null;
        
        if(!cc.sys.isNative) {
            socket = connect('http://192.168.31.246:8000');
            socket.on('connected', function(msg){
                self.label.string = "web调试：" + msg;
                console.log("返回信息-------------" + msg);
            });
        }
        else {
            socket = io.connect('http://192.168.31.246:8000');
            socket.on('connected', function(msg){
                self.label.string = "安卓调试：" + msg;
                console.log("返回信息-------------" + msg);
            });
        }

    }
}
