This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.push.test; | |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
import java.util.LinkedList; | |
import java.util.List; | |
import com.notnoop.apns.APNS; | |
import com.notnoop.apns.ApnsDelegate; | |
import com.notnoop.apns.ApnsNotification; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################### | |
# chkconfig: 2345 90 10 | |
# description: Redis is a persistent key-value database | |
PATH=/usr/local/bin:/sbin:/usr/bin:/bin | |
REDISPORT=6379 | |
EXEC=/usr/local/bin/redis-server | |
REDIS_CLI=/usr/local/bin/redis-cli | |
PIDFILE=/var/run/redis.pid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
wget http://download.redis.io/releases/redis-2.8.7.tar.gz | |
tar -zxf redis-*.tar.gz | |
cd redis-* | |
make | |
make install | |
cp redis.conf /etc | |
useradd redis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.mqtt.handler.coder; | |
import io.netty.buffer.Unpooled; | |
import io.netty.channel.ChannelHandler.Sharable; | |
import io.netty.channel.ChannelHandlerContext; | |
import io.netty.handler.codec.MessageToMessageEncoder; | |
import java.util.List; | |
import org.meqantt.message.Message; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.mqtt.handler; | |
import io.mqtt.processer.ConnectProcesser; | |
import io.mqtt.processer.DisConnectProcesser; | |
import io.mqtt.processer.PingReqProcesser; | |
import io.mqtt.processer.Processer; | |
import io.mqtt.processer.PublishProcesser; | |
import io.mqtt.processer.SubscribeProcesser; | |
import io.mqtt.processer.UnsubscribeProcesser; | |
import io.netty.channel.ChannelFutureListener; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TcpChannelInitializer extends ChannelInitializer<SocketChannel> { | |
@Override | |
public void initChannel(SocketChannel ch) throws Exception { | |
ChannelPipeline pipeline = ch.pipeline(); | |
pipeline.addLast( | |
new MqttMessageNewEncoder(), | |
new MqttMessageNewDecoder(), | |
new MqttMessageHandler()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.mqtt.handler.HttpRequestHandler; | |
import io.mqtt.handler.MqttMessageHandler; | |
import io.mqtt.handler.coder.MqttMessageWebSocketFrameDecoder; | |
import io.mqtt.handler.coder.MqttMessageWebSocketFrameEncoder; | |
import io.mqtt.handler.http.HttpJsonpTransport; | |
import io.netty.channel.ChannelInitializer; | |
import io.netty.channel.socket.SocketChannel; | |
import io.netty.handler.codec.http.HttpObjectAggregator; | |
import io.netty.handler.codec.http.HttpServerCodec; | |
import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Sharable | |
public class MqttMessageWebSocketFrameEncoder extends | |
MessageToMessageEncoder<Message> { | |
@Override | |
protected void encode(ChannelHandlerContext ctx, Message msg, | |
List<Object> out) throws Exception { | |
if (msg == null) | |
return; | |
byte[] data = ((Message) msg).toBytes(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MqttMessageWebSocketFrameDecoder extends | |
MessageToMessageDecoder<BinaryWebSocketFrame> { | |
private MqttMessageNewDecoder messageNewDecoder; | |
public MqttMessageWebSocketFrameDecoder() { | |
messageNewDecoder = new MqttMessageNewDecoder(); | |
} | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%%------------------------------------------------------------------- | |
%%% @author nieyong | |
%%% @copyright (C) 2015 | |
%%% @doc | |
%%% DNS解析测试 | |
%%% @end | |
%%%------------------------------------------------------------------- | |
-module(test1). | |
-export([start/2]). |
OlderNewer