 			bytes.writeByte(msgid % 256);
 			
 			var i:int;
+			var pattern:RegExp = /\/|\+|\#/;
+			
 			for(i = 0; i < topicnames.length; i++){
+				if (topicnames[i].search(pattern) != -1)
+					throw new Error("Illegal topic name,include: ".concat(TOPIC_LEVEL_SEPARATOR,TOPIC_M_LEVEL_WILDCARD,TOPIC_S_LEVEL_WILDCARD));
 				if (topicnames[i].length > MAX_LEN_TOPIC)
 					throw new Error("Out of range ".concat(MAX_LEN_TOPIC, "!"));
 				

		//----------------------------------
		//  CONSTANTS
		//----------------------------------
		private static const MAX_LEN_UUID:int=16;
		private static const MAX_LEN_TOPIC:int=7;
		private static const MAX_LEN_USERNAME:int=12;
		//Topic level separator

		//
		public function publish(content:String, topicname:String, QoS:int=0, retain:int=0):void
		{
			var pattern:RegExp = /\/|\+|\#/;
			if (topicname.search(pattern) != -1)
				throw new Error("Illegal topic name,include: ".concat(TOPIC_LEVEL_SEPARATOR,TOPIC_M_LEVEL_WILDCARD,TOPIC_S_LEVEL_WILDCARD));
			//TODO:socket sever response detect.
			var bytes:ByteArray=new ByteArray();
			writeString(bytes, topicname);
