Message
。Type | Name | Description |
System.String | conv_id | 会话ID |
TIMConvType | conv_type | 会话类型 TIMConvType |
Message | message | 消息体 Message |
System.Text.StringBuilder | message_id | 承接消息 ID 的 StringBuilder |
ValueCallback | ValueCallback | callback | 异步回调 |
public static void MsgSendMessage() {string conv_id = ""; // c2c 消息会话 ID 为 userID,群消息会话 ID 为 groupIDMessage message = new Message{message_conv_id = conv_id,message_conv_type = TIMConvType.kTIMConv_C2C, // 群消息为TIMConvType.kTIMConv_Groupmessage_elem_array = new List<Elem>{new Elem{elem_type = TIMElemType.kTIMElem_Text,text_elem_content = "这是一个普通文本消息"}}};StringBuilder messageId = new StringBuilder(128);TIMResult res = TencentIMSDK.MsgSendMessage(conv_id, TIMConvType.kTIMConv_C2C, message, messageId, (int code, string desc, string json_param, string user_data)=>{// 消息发送异步结果});// 消息发送同步返回的消息ID messageId}
public static void MsgSendMessage() {string conv_id = ""; // c2c 消息会话 ID 为 userID,群消息会话 ID 为 groupIDMessage message = new Message{message_conv_id = conv_id,message_conv_type = TIMConvType.kTIMConv_C2C, // 群消息为TIMConvType.kTIMConv_Groupmessage_elem_array = new List<Elem>{new Elem{elem_type = TIMElemType.kTIMElem_Image,image_elem_orig_path = "/Users/xxx/xxx.png", // 文件绝对路径image_elem_level = TIMImageLevel.kTIMImageLevel_Orig // 原图发送}}};StringBuilder messageId = new StringBuilder(128);TIMResult res = TencentIMSDK.MsgSendMessage(conv_id, TIMConvType.kTIMConv_C2C, message, messageId, (int code, string desc, string json_param, string user_data)=>{// 消息发送异步结果});// 消息发送同步返回的消息ID messageId}
public static void MsgSendMessage() {string conv_id = ""; // c2c 消息会话 ID 为 userID,群消息会话 ID 为 groupIDMessage message = new Message{message_conv_id = conv_id,message_conv_type = TIMConvType.kTIMConv_C2C, // 群消息为TIMConvType.kTIMConv_Groupmessage_elem_array = new List<Elem>{new Elem{elem_type = TIMElemType.kTIMElem_Sound,sound_elem_file_path = "/Users/xxx/xxx.mp3", // 文件绝对路径sound_elem_file_size = 10 // 语音时长}}};StringBuilder messageId = new StringBuilder(128);TIMResult res = TencentIMSDK.MsgSendMessage(conv_id, TIMConvType.kTIMConv_C2C, message, messageId, (int code, string desc, string json_param, string user_data)=>{// 消息发送异步结果});// 消息发送同步返回的消息ID messageId}
public static void MsgSendMessage() {string conv_id = ""; // c2c 消息会话 ID 为 userID,群消息会话 ID 为 groupIDMessage message = new Message{message_conv_id = conv_id,message_conv_type = TIMConvType.kTIMConv_C2C, // 群消息为TIMConvType.kTIMConv_Groupmessage_elem_array = new List<Elem>{new Elem{elem_type = TIMElemType.kTIMElem_Video,video_elem_video_path = "/Users/xxx/xxx.mp4", // 文件绝对路径video_elem_video_type = "mp4", // 视频类型video_elem_video_duration = 10, // 视频时长video_elem_image_path = "本地视频封面文件绝对路径",video_elem_image_type = "png", // 视频截图文件类型video_elem_image_size = 100, // 视频截图文件大小video_elem_image_width = 1920, // 视频截图文件宽video_elem_image_height = 1080, // 视频截图文件高}}};StringBuilder messageId = new StringBuilder(128);TIMResult res = TencentIMSDK.MsgSendMessage(conv_id, TIMConvType.kTIMConv_C2C, message, messageId, (int code, string desc, string json_param, string user_data)=>{// 消息发送异步结果});// 消息发送同步返回的消息ID messageId}
public static void MsgSendMessage() {string conv_id = ""; // c2c 消息会话 ID 为 userID,群消息会话 ID 为 groupIDMessage message = new Message{message_conv_id = conv_id,message_conv_type = TIMConvType.kTIMConv_C2C, // 群消息为TIMConvType.kTIMConv_Groupmessage_elem_array = new List<Elem>{new Elem{elem_type = TIMElemType.kTIMElem_File,file_elem_file_path = "/Users/xxx/xxx.x", // 文件绝对路径file_elem_file_name = "文件名",}}};StringBuilder messageId = new StringBuilder(128);TIMResult res = TencentIMSDK.MsgSendMessage(conv_id, TIMConvType.kTIMConv_C2C, message, messageId, (int code, string desc, string json_param, string user_data)=>{// 消息发送异步结果});// 消息发送同步返回的消息ID messageId}
public static void MsgSendMessage() {string conv_id = ""; // c2c 消息会话 ID 为 userID,群消息会话 ID 为 groupIDMessage message = new Message{message_conv_id = conv_id,message_conv_type = TIMConvType.kTIMConv_C2C, // 群消息为TIMConvType.kTIMConv_Groupmessage_elem_array = new List<Elem>{new Elem{elem_type = TIMElemType.kTIMElem_Location,location_elem_desc = "深圳市南山区深南大道", // 位置信息摘要location_elem_longitude = 34, // 经度location_elem_latitude = 20 // 纬度}}};StringBuilder messageId = new StringBuilder(128);TIMResult res = TencentIMSDK.MsgSendMessage(conv_id, TIMConvType.kTIMConv_C2C, message, messageId, (int code, string desc, string json_param, string user_data)=>{// 消息发送异步结果});// 消息发送同步返回的消息ID messageId}
public static void MsgSendMessage() {string conv_id = ""; // c2c 消息会话 ID 为 userID,群消息会话 ID 为 groupIDMessage message = new Message{message_conv_id = conv_id,message_conv_type = TIMConvType.kTIMConv_C2C, // 群消息为TIMConvType.kTIMConv_Groupmessage_elem_array = new List<Elem>{new Elem{elem_type = TIMElemType.kTIMElem_Face,face_elem_index = 0,face_elem_buf = ""}}};StringBuilder messageId = new StringBuilder(128);TIMResult res = TencentIMSDK.MsgSendMessage(conv_id, TIMConvType.kTIMConv_C2C, message, messageId, (int code, string desc, string json_param, string user_data)=>{// 消息发送异步结果});// 消息发送同步返回的消息ID messageId}
public static void MsgSendMessage() {string conv_id = ""; // c2c 消息会话 ID 为 userID,群消息会话 ID 为 groupIDMessage message = new Message{message_conv_id = conv_id,message_conv_type = TIMConvType.kTIMConv_C2C, // 群消息为TIMConvType.kTIMConv_Groupmessage_elem_array = new List<Elem>{new Elem{elem_type = TIMElemType.kTIMElem_Custom,custom_elem_data = "",custom_elem_desc = "",custom_elem_ext = ""}}};StringBuilder messageId = new StringBuilder(128);TIMResult res = TencentIMSDK.MsgSendMessage(conv_id, TIMConvType.kTIMConv_C2C, message, messageId, (int code, string desc, string json_param, string user_data)=>{// 消息发送异步结果});// 消息发送同步返回的消息ID messageId}
本页内容是否解决了您的问题?